• Resolved mrkapable007

    (@mrkapable007)


    Hi,

    What is the code snippet to add so google can always crawl prices only in USD, this is affecting merchant center, i see in some other plugins, you can add custom code to allow google bot to crawl prices in USD only.

    This would be helpful to avoid issues in merchant center, and also this would be avoid the need to add custom parameters to the url.

    Hoping for some results.

    Here is something i found, kindly check and check if this would work?

    `function wpbc_visitor_is_bot() {
    $user_agent = isset($_SERVER[‘HTTP_USER_AGENT’]) ? $_SERVER[‘HTTP_USER_AGENT’] : null;
    $bot_types = ‘bot|crawl|slurp|spider’;

    return !empty($user_agent) ? preg_match(“/$bot_types/”, $user_agent) > 0 : false;
    }

    function set_currency_for_bots() {
    // Only change the currency for bots, and only on the frontend
    if(wpbc_visitor_is_bot() && (!is_admin() || defined(‘DOING_AJAX’))) {
    // Always force selected currency to US Dollars. Bots will always see prices
    $_POST[‘wcpbc_currency_switcher’] = ‘USD’;
    }
    }
    add_action(‘woocommerce_init’, ‘set_currency_for_bots’, 0);

    • This topic was modified 2 years, 5 months ago by mrkapable007.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Oscar Gare

    (@oscargare)

    Hi,

    What you are trying is not going to work:
    1. The plugin does not read the wcpbc_currency_switcher parameter.
    2. Price Based on Country is not a currency switcher plugin, so there is no way to change the currency. You have to change the customer’s country to change the pricing zone. Use the URL parameter wcpbc-manual-country to change the country:
    https://www.example.com?wcpbc-manual-country=US Set the customer country to the United States.
    3. Your PHP code will not run if you use a cache plugin and does not generate a different cache version for these user agents.

    The best way to solve this issue is to add the parameter wcpbc-manual-country to all URLs of the google feed:
    https://www.ads-software.com/support/topic/merchant-center-mismatched-price-for-multi-currency-2/

    Thread Starter mrkapable007

    (@mrkapable007)

    Hi Thank you,

    I understand clearly now.

    So i made a little check and i found out that the woocommerce payment is at fault, when multicurrency is enabled in woocommerce payment, this issue occurs, when i disable the option that says “Allow customers to shop and pay in multiple currencies.” then the issue is gone.

    How to solve this? thanks.

    Plugin Author Oscar Gare

    (@oscargare)

    With Price Based on Country, you don’t need to enable the WooCommerce Payments Multi-currency to receive payments on multiple currencies through WooCommerce Payments.
    Enabling this option of WooCommerce Payments will cause issues in the price because of double currency conversion. Disable the WooCommerce Payments Multi-currency to solve the problems.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Google Crawl Price’ is closed to new replies.