WooCommerce: Google prices are only displayed net

WooCommerce: Google prices are only displayed net

WooCommerce passes the prices to Google only net. The reason for this is simply because the JSON block prepared for Google contains the net price. To prevent this we need to change the file

wp-content/plugins/woocommerce/includes/class-wc-structured-data.php

file accordingly. For the array of type Offer there are two hits that can be adjusted as follows:

Geschützter Bereich

Dieser Inhalt ist passwortgeschützt. Bitte gib dein Passwort ein um den Inhalt freizuschalten.

This article contains protected areas which can be unlocked with a password for existing customers.

It’s especially annoying when the file is constantly being overwritten, but fortunately we can remedy that:

<?php
$fname = "class-wc-structured-data.php.new";
$fname = "class-wc-structured-data.php";
$fhandlen = fopen($fname, "r");
$content = fread($fhandlen,filesize($fname));
fclose($fhandlen);
$fhandle = fopen($fname, "w");
fwrite($fhandle,$content);
fclose($fhandle);
exit;
?>

Need help solving the problem? Write me via my contact form!

Leave a Reply

Your email address will not be published. Required fields are marked *