• Resolved SBIMarketing

    (@sbimarketing)


    We have several clients using this plugin (and it’s been great!) but one client just reported that Google is displaying the hidden price – the price you need to be logged in to see – in the search results.

    It seems that even though the price is being filtered out of the HTML in the page, the price is still in the product schema:

    <script type="application/ld+json">{"@context":"https:\/\/schema.org\/","@graph":[{"@context":"https:\/\/schema.org\/","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"item":{"name":"Home","@id":"https:\/\/kimdec.com.au"}},{"@type":"ListItem","position":2,"item":{"name":"Milk_shake","@id":"https:\/\/kimdec.com.au\/product-category\/milk_shake\/"}},{"@type":"ListItem","position":3,"item":{"name":"DECOLOGIC LEVEL 9 500GR","@id":"https:\/\/kimdec.com.au\/product\/decologic-level-9-500gr\/"}}]},{"@context":"https:\/\/schema.org\/","@type":"Product","@id":"https:\/\/kimdec.com.au\/product\/decologic-level-9-500gr\/#product","name":"DECOLOGIC LEVEL 9 500GR","url":"https:\/\/kimdec.com.au\/product\/decologic-level-9-500gr\/","image":"https:\/\/kimdec.com.au\/wp-content\/uploads\/2019\/09\/milk-shake-decologic-level-9-500g.jpg","description":"","sku":14973,"offers":[{"@type":"Offer","price":"39.95","priceValidUntil":"2021-12-31","priceSpecification":{"price":"39.95","priceCurrency":"AUD","valueAddedTaxIncluded":"false"},"priceCurrency":"AUD","availability":"http:\/\/schema.org\/InStock","url":"https:\/\/kimdec.com.au\/product\/decologic-level-9-500gr\/","seller":{"@type":"Organization","name":"KIMDEC","url":"https:\/\/kimdec.com.au"}}]}]}</script>

    Google seems to be extracting this information and displaying it in search results when you search for a specific topic.

    What do you suggest we do to prevent wholesale prices being shown to the public in this way?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Fauzan Azizie

    (@fauzanade)

    Hi @sbimarketing,

    I assumed that you’re using a snippet to hide the regular price from the non-logged in user? I’m afraid this snippet doesn’t handle the structured data WooCommerce’s output by default.

    In order to remove the price data from the JSON, you can use the following snippet:

    add_filter( ‘woocommerce_structured_data_product_offer’, function( $markup_offer, $product ) {
    if( isset( $markup_offer[ ‘price’ ] ) )
    unset( $markup_offer[ ‘price’ ] );

    if( $markup_offer[ ‘priceSpecification’ ][ ‘price’] )
    unset( $markup_offer[ ‘priceSpecification’ ][ ‘price’] );

    return $markup_offer;

    }, 10 , 2);

    I hope this help,

    Best regards

    Thread Starter SBIMarketing

    (@sbimarketing)

    That works perfectly – thanks so much!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Google Retrieving Prices from Schema’ is closed to new replies.