klaviyo / magento2-klaviyo

38 stars 51 forks source link

FinalPrice pushed as exclude tax from PDP #312

Open mamsincl opened 1 month ago

mamsincl commented 1 month ago

Environment details

PHP version: 8.1.28 Magento version: 2.4.5-p9 Klaviyo extension version: 4.1.3 (Magento Cloud, so please do not judge the php version)

Steps to reproduce

Visit PDP check the rendered klaviyo.push payload: discrepancy in FinalPrice and the rendered price for the end customer image

Expected result

FinalPrice is set to be the same as the rendered price

OR

the FinalPrice should follow the visibility setting of product price

Actual result

final price without tax added to JSON payload

Additional information

https://github.com/klaviyo/magento2-klaviyo/blob/master/Block/Catalog/Product/ViewedProduct.php#L161

when this being changed to use getAmount()->getValue() on the final price object - instead of getValue(), the include tax price being added as FinalPrice

also, please see https://belvg.com/blog/the-functionality-and-basic-concepts-of-price-generation-in-magento-2.html image

mamsincl commented 1 month ago

some extra info: our client has conversation with support and they given the following answer:

  • If you're working with a Magento 2 integration and need to ensure that product prices in your Klaviyo email campaigns include VAT, there are several steps you can take to address this issue effectively.
  • Firstly, it's important to make sure that your Magento 2 store is configured to display prices inclusive of VAT. This can be adjusted in the Magento admin panel under Stores > Configuration > Sales > Tax > Price Display Settings. Here, you should set the options to ensure that the prices shown to customers on your storefront include VAT. This ensures that the prices your customers see on your website are consistent with what they see in your email campaigns.
  • You can find more information in this article: How to Configure Value Added Tax (VAT) in Magento 2.
  • Next, to ensure that VAT-inclusive prices are reflected in Klaviyo, you need to confirm that the pricing data being sent from Magento to Klaviyo includes VAT. By default, Klaviyo pulls the price data directly from Magento, and if Magento is set to display prices without VAT, Klaviyo will do the same. To correct this, you may need to customize the integration or work with a developer to ensure that the prices sent to Klaviyo are VAT-inclusive. This might involve modifying how prices are calculated and passed through Magento’s API to Klaviyo.
  • If VAT-inclusive prices are properly synced to Klaviyo, you can then customize your email templates in Klaviyo to ensure that the correct pricing is displayed. When setting up your product blocks, make sure they are configured to pull the pricing data that includes VAT. If the integration still doesn’t automatically reflect VAT-inclusive prices, a workaround could involve using custom properties or scripts within Klaviyo to manually adjust the prices displayed in the emails. However, this approach would require some coding knowledge.
  • For example in order to add a percentage of 20% you will need to use the tag multiply, as per this example the code would be {% currency_format item.line_price|multiply:1.2 %}
smoucka commented 1 month ago

@mamsincl Thank you for filing this issue and submitting a PR. I have commented on #313.