Skip to content

Commit

Permalink
fix: Add offers info to website item
Browse files Browse the repository at this point in the history
  • Loading branch information
deepeshgarg007 committed Apr 15, 2023
1 parent 7fabe62 commit 88b598e
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion erpnext/e_commerce/doctype/website_item/website_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from frappe.website.doctype.website_slideshow.website_slideshow import get_slideshow
from frappe.website.website_generator import WebsiteGenerator

from erpnext import get_default_currency
from erpnext.e_commerce.doctype.item_review.item_review import get_item_reviews
from erpnext.e_commerce.redisearch_utils import (
delete_item_from_index,
Expand Down Expand Up @@ -221,8 +222,8 @@ def get_context(self, context):
if self.slideshow:
context.update(get_slideshow(self))

self.set_metatags(context)
self.set_shopping_cart_data(context)
self.set_metatags(context)

settings = context.shopping_cart.cart_settings

Expand Down Expand Up @@ -305,8 +306,19 @@ def set_metatags(self, context):

context.metatags.title = self.web_item_name or self.item_name or self.item_code

settings = context.shopping_cart.cart_settings
selling_price_list = _set_price_list(settings, None)
price = get_price(
self.item_code, selling_price_list, settings.default_customer_group, settings.company
)

context.metatags["og:type"] = "product"
context.metatags["og:site_name"] = "ERPNext"
context.metatags["og:offers"] = {
"@type": "Offer",
"price": price,
"priceCurrency": get_default_currency(),
}

def set_shopping_cart_data(self, context):
from erpnext.e_commerce.shopping_cart.product_info import get_product_info_for_website
Expand Down

0 comments on commit 88b598e

Please sign in to comment.