Add attributes in Offer

#389968
  • Tôi muốn thêm thuộc tính trong Offer, ví dụ:
    offers
    @type Offer
    price 632000
    priceValidUntil 2023-12-31
    priceCurrency VND
    availability http://schema.org/InStock
    url https://ceoia.com.vn/tuytsi-trousers/
    seller
    @type Organization

    I am missing itemCondition attribute, how do I add it if not using template schema.
    Suggest me hook for me to do this.

    Result after adding:
    offers
    @type Offer
    price 632000
    priceValidUntil 2023-12-31
    priceCurrency VND
    availability http://schema.org/InStock
    itemCondition http://schema.org/NewCondition
    url https://ceoia.com.vn/tuytsi-trousers/
    seller
    @type Organization

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hello,

    Thank you for contacting the support.

    You can modify and use this filter to add a new entity:
    https://rankmath.com/kb/filters-hooks-api-developer/#change-post-schema-data

    Here’s a code that you can further modify and use:

    add_filter( 'rank_math/snippet/rich_snippet_product_entity', function( $entity ) {
    	if(false !== is_product()){
        	  $entity['offers']['itemCondition'] = 'NewCondition';
    	}
        return $entity;
    });

    You can add the filter by following this guide:
    https://rankmath.com/kb/wordpress-hooks-actions-filters/

    Hope this helps.

    Thank you.

    Many thanks, I made it.
    I have another problem I would like help with. My product catalog does not list product schemas. For example, there are 4 products in a product category I want to display all 4 schema products in that category, how do I do that. Hope for support.

    Hello,

    We suggest not adding product schemas to product category pages.

    Google recommends disabling the schema to your product category page and the product Schema is only for the actual product and not for anything else.

    Product Schema Category

    You can check this link for more information:
    https://developers.google.com/search/docs/data-types/product#guidelines

    I hope that helps.

    Thank you, and please don’t hesitate to contact us anytime if you need further assistance with anything else.

    Thank you.
    And one more thing that I use Flatsome theme which uses product variation. When I check my product, it only has the discounted price parameter and the original value does not.

    @type Offer
    price 504000
    priceValidUntil 2023-12-31
    priceCurrency VND
    availability http://schema.org/InStock

    And there is no parameter value of the variants.

    Hello,

    Please share the URL of an affected product so we can check and assist you further.

    Looking forward to helping you.

    Hello,

    I can check that the current price of your product is being added to the Schema. You can’t add two prices under one and as per Google’s guidelines, you should add the current price of your product in the Schema. The price valid until property will let Google know that it is the sale price and will expire after the mentioned date.

    And our plugin generates offers for variations when they have different prices. Since all your variations have the same price there is one offer property.

    Hope this helps. Let us know if you need any other assistance.

    Thanks.

Viewing 7 replies - 1 through 7 (of 7 total)

You must be logged in to reply to this ticket.