Same issue. Following.
EDIT:
Found setting under product catalogue – edit feed url – special mapping – price – including taxes
-
This reply was modified 3 years, 11 months ago by Robothead.
Yes @toktor ! Thank you for reporting the option you mentioned, I added this recently in order to give you ability to decide if you want the prices included or excluded taxes 🙂
Thread Starter
benir
(@benir)
GAME CHANGER THANK YOU FOR ADDING THIS
You’re welcome! Really happy you solved your issue! 🙂
If you need further help, don’t hesitate to open a new topic.
If you love the plugin, please share your experience with Pixel Caffeine from here, it would be much appreciated! 🙂
Have a nice day!
hello
what if woocommerce VAT settings is setup to display prices with VAT or without VAT depending on user location (geolocating them) and not by store location? in this case that option is not working and prices in the feed beeing generated without VAT. is there any workaround for this?
Hi,
unfortunately, it’s not possible to set a geolocalization in the Product Catalog, because you cannot set in Facebook Product Feed different prices matrix depending on geolocalization.
i see, but maybe there’s a way to forcibly add +20% VAT for all the prices in the feed?
Hi,
you may do that by adding a little hook in the code. Here it is:
add_filter('aepc_feed_item', function($fields, $item) {
$product_id = $item->get_id();
// EDIT HERE
$fields['g:price'] = $fields['g:price'] + $fields['g:price'] * 0.2;
// END EDIT HERE
return $fields;
}, 10, 2);
You can add this hook at the end of functions.php
file of your current theme or in a new plugin.
thanks Antonino, i’ll try that.
well, unfortunetelly this code strips currency symbol from feed:
<g:price>57.5 GBP</g:price>
becomes
<g:price>69</g:price>
any thoughts?
You’re right, sorry my bad.
Here the fixed version:
add_filter('aepc_feed_item', function($fields, $item) {
/** @var \PixelCaffeine\ProductCatalog\FeedMapper $item */
$product_id = $item->get_id();
// EDIT HERE
$price = floatval(trim(str_replace($item->get_currency(), '', $item->get_price())));
$fields['g:price'] = ( $price + $price * 0.2 ) . ' ' . $item->get_currency();
// END EDIT HERE
return $fields;
}, 10, 2);
It restores the currency inside the price param.
Let me know.
ok, i’ll try, just one more question – what about sale price? i see it in the feed as well if product has it defined. i guess i need to add similar calc line?
Yes correct, here it is:
add_filter('aepc_feed_item', function($fields, $item) {
/** @var \PixelCaffeine\ProductCatalog\FeedMapper $item */
$product_id = $item->get_id();
// EDIT HERE
$price = floatval(trim(str_replace($item->get_currency(), '', $item->get_price())));
$fields['g:price'] = ( $price + $price * 0.2 ) . ' ' . $item->get_currency();
$salePrice = floatval(trim(str_replace($item->get_currency(), '', $item->get_sale_price())));
$fields['g:sale_price'] = ( $salePrice + $salePrice * 0.2 ) . ' ' . $item->get_currency();
// END EDIT HERE
return $fields;
}, 10, 2);
thanks a lot, i’ll try it.
the code works, but it adds sale_price with 0 GBP value if product doesn’t have sale price defined. i guess it needs some “if” statement to print sale_price tag conditionally.