Question about SCHEMA / header Module Offer or Product

Open to all! Ask other shopowners for help.
Post Reply
loop
Contributor
Posts: 253
Joined: Thu Mar 25, 2021 12:26 pm
Phoenix Version:
Has thanked: 7 times
Been thanked: 3 times

Question about SCHEMA / header Module Offer or Product

Post by loop »

Hi All
At the moment i use the headermodule for schema, with type=product for the snippet. i received a email from google that on my site is missing shippingdetails on the schema after a lot of googling i found out that there exist a tag "shippingdetail" but not in the schema for products, it's only in offer.

at the moment i don't get it what is correct, do i need to have a snippet for product or for offer? can anybody help me here? thanks!

Code: Select all

"shippingDetails": {
      "@type": "ShippingDetails",
      "shippingRate": {
        "@type": "MonetaryAmount",
        "currency": "CHF",
        "value": "Hier Versandpreis einfügen"
      },
      "shippingDestination": {
        "@type": "DefinedRegion",
        "name": "Hier Region einfügen"
      },
      "shippingDestinationDescription": "Der Preis ist für die gesamte Region gleich."
    }


Join The Code Co-op to get access to your library in the Code Co-op Forum
User avatar
burt
Core Team
Posts: 4560
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 413 times

Re: Question about SCHEMA / header Module Offer or Product

Post by burt »

Would not be possible in most sites as shipping is worked out in the checkout process.
Shipping prices is (usually) unavailable before the checkout.
I am not here to build for you.
I am here to build with you. Let's help each other.
User avatar
Pierre_P
Contributor
Posts: 144
Joined: Fri Mar 12, 2021 5:06 am
Phoenix Version: v1.1.0.6
Has thanked: 21 times
Been thanked: 11 times

Re: Question about SCHEMA / header Module Offer or Product

Post by Pierre_P »

@loop

I'm busy looking into this as well, but not getting any further with this and will need some help :D
I have seen Burt's comment about shipping, currently free shipping or fixed shipping can do

I'm getting 2 errors for merchant listings(snippets part 100% correct)
1: missing field "delivery time"
2: Either "returnFees" or "returnShippingFeesAmount" should be specified (optional)

Not to sure what is missing required to get 100% going
Obviously this settings needs customization to your own store and country.

Code: Select all

        
        // Added NewCondition - all items is new
          $schema_product['offers']['itemCondition'] = 'https://schema.org/NewCondition';

          $schema_product['offers']['shippingDetails'] = [
              '@type' => 'OfferShippingDetails',
                  'shippingRate' => [
                  '@type' => 'MonetaryAmount',
                  'value' => '0',
                  'currency' => 'ZAR',
              ],
              'shippingDestination' =>  [
                  '@type'  => 'DefinedRegion',
                  'addressCountry' => 'ZA',
              ],
          ];

          $schema_product['offers']['deliveryTime'] = [
                  '@type' => 'ShippingDeliveryTime',
                  'handlingTime' => [
                  '@type' => 'QuantitativeValue',
                  'minValue' => '0',
                  'maxValue' => '1',
                  'unitCode' => 'DAY',
              ],
              'transitTime' => [
                  '@type' => 'QuantitativeValue',
                  'minValue' => '1',
                  'maxValue' => '5',
                  'unitCode' => 'DAY',
              ],
          ];

          $schema_product['offers']['seller'] = [
              '@type' => 'Organization',
              'name' => STORE_NAME,
          ];

          $schema_product['offers']['hasMerchantReturnPolicy'] = [
              '@type' => 'MerchantReturnPolicy',
              'applicableCountry' => 'ZA',
              'returnPolicyCategory' => 'MerchantReturnFiniteReturnWindow',
              'merchantReturnDays' => '14',
              'returnMethod' => 'ReturnInStore',
              // 'returnFees' => 'ReturnFeesCustomerResponsibility',
          ];
And reviews was also complaining about author so i did this to solved it

Code: Select all

          $schema_product['review'] = [];
          foreach ($product->get('reviews') as $review) {
              $schema_product['review'][] = [
                '@type'         => 'Review',
               // 'author'        => htmlspecialchars($review['customers_name']),
                'datePublished' => htmlspecialchars($review['date_added']),
                'description'   => htmlspecialchars($review['text']),
                // 'name'          => htmlspecialchars($product->get('name')),
                'author'  => [
                      '@type'       => 'Person',
                      'name'        => htmlspecialchars($review['customers_name']),
                  ],
                  'reviewRating'  => [
                  '@type'       => 'Rating',
                  'bestRating'  => '5',
                  'ratingValue' => (int)$review['rating'],
                  'worstRating' => '1',
                ],
              ];
Also normal products now requires priceValidUntil

Code: Select all

              $schema_product['offers']['price'] = $product->format_raw();
              $date = date('Y-m-d');
              $nextweek = date('Y-m-d',strtotime('+7 day',strtotime($date)));
              $schema_product['offers']['priceValidUntil'] = $nextweek;
User avatar
burt
Core Team
Posts: 4560
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 413 times

Re: Question about SCHEMA / header Module Offer or Product

Post by burt »

I am not here to build for you.
I am here to build with you. Let's help each other.
User avatar
burt
Core Team
Posts: 4560
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 413 times

Re: Question about SCHEMA / header Module Offer or Product

Post by burt »

Pierre_P wrote: Tue May 09, 2023 2:49 pm 1: missing field "delivery time"
https://schema.org/ShippingDeliveryTime - scroll to "instances of ShippingDeliveryTime may appear as a value for the following properties", which says that https://schema.org/deliveryTime should be
The total delay between the receipt of the order and the goods reaching the final customer.
However, do note that these are warnings not errors. Core Team is probably never going to look at a warning in terms of fixing up for Core.

I do remember having a conversation about making these schema modules extendable more easily. Not sure how to approach that yet, even so, making it more easily extendable would not really solve future warnings and errors - code would still be needed.
I am not here to build for you.
I am here to build with you. Let's help each other.
User avatar
Pierre_P
Contributor
Posts: 144
Joined: Fri Mar 12, 2021 5:06 am
Phoenix Version: v1.1.0.6
Has thanked: 21 times
Been thanked: 11 times

Re: Question about SCHEMA / header Module Offer or Product

Post by Pierre_P »

Thanks @burt
This solves the shipping part

Code: Select all

          $schema_product['offers']['shippingDetails'] = [
              '@type' => 'OfferShippingDetails',
              'shippingDestination' =>  [
                  '@type'  => 'DefinedRegion',
                  'addressCountry' => 'ZA',
              ],
          'deliveryTime' => [
                  '@type' => 'ShippingDeliveryTime',
              'handlingTime' => [
                  '@type' => 'QuantitativeValue',
                  'minValue' => '0',
                  'maxValue' => '1',
                  'unitCode' => 'd',
              ],
              'transitTime' => [
                  '@type' => 'QuantitativeValue',
                  'minValue' => '1',
                  'maxValue' => '5',
                  'unitCode' => 'd',
              ],
          ],
              'businessDays' => [
                  '@type' => 'OpeningHoursSpecification',
                  ],
                  'dayOfWeek' => [
              'https://schema.org/Monday',
              'https://schema.org/Tuesday',
              'https://schema.org/Wednesday',
              'https://schema.org/Thursday',
              'https://schema.org/Friday',
                  ],
              'cutoffTime' => '09:00:15Z',
              'shippingRate' => [
                  '@type' => 'MonetaryAmount',
                  'value' => '0',
                  'currency' => 'ZAR',
              ],
          ];
lecarlb
Contributor
Posts: 316
Joined: Mon Oct 26, 2020 5:26 pm
Phoenix Version:
Has thanked: 48 times
Been thanked: 9 times

Re: Question about SCHEMA / header Module Offer or Product

Post by lecarlb »

@Pierre_P,

Are you willing to share the file where you made those changes and the version of stores you applied them to?

I'm experiencing the same issues including No global identifier provided (e.g., gtin, brand)

Thanks.
User avatar
Pierre_P
Contributor
Posts: 144
Joined: Fri Mar 12, 2021 5:06 am
Phoenix Version: v1.1.0.6
Has thanked: 21 times
Been thanked: 11 times

Re: Question about SCHEMA / header Module Offer or Product

Post by Pierre_P »

lecarlb wrote: Wed May 10, 2023 7:26 am I'm experiencing the same issues including No global identifier provided (e.g., gtin, brand)
Phoenix v1.0.8.21
If no gtin is specified then you will get this warning, Google will accept mpn instead(manufacterer part number).
mpn and brand are already specified in existing code.

We can certainly play around this for now as it could boost product performence and apearance in search
I think best is that a certified developer work on this, it becomes a rabit hole to accurately specify all the details required that will work for all users.
Omar_one
Senior Contributor
Posts: 679
Joined: Fri Oct 25, 2019 5:06 pm
Phoenix Version: v1.0.8.16
Has thanked: 100 times
Been thanked: 56 times

Re: Question about SCHEMA / header Module Offer or Product

Post by Omar_one »

Pierre_P wrote: Tue May 09, 2023 4:05 pm Thanks @burt
This solves the shipping part

Code: Select all

          $schema_product['offers']['shippingDetails'] = [
              '@type' => 'OfferShippingDetails',
              'shippingDestination' =>  [
                  '@type'  => 'DefinedRegion',
                  'addressCountry' => 'ZA',
              ],
          'deliveryTime' => [
                  '@type' => 'ShippingDeliveryTime',
              'handlingTime' => [
                  '@type' => 'QuantitativeValue',
                  'minValue' => '0',
                  'maxValue' => '1',
                  'unitCode' => 'd',
              ],
              'transitTime' => [
                  '@type' => 'QuantitativeValue',
                  'minValue' => '1',
                  'maxValue' => '5',
                  'unitCode' => 'd',
              ],
          ],
              'businessDays' => [
                  '@type' => 'OpeningHoursSpecification',
                  ],
                  'dayOfWeek' => [
              'https://schema.org/Monday',
              'https://schema.org/Tuesday',
              'https://schema.org/Wednesday',
              'https://schema.org/Thursday',
              'https://schema.org/Friday',
                  ],
              'cutoffTime' => '09:00:15Z',
              'shippingRate' => [
                  '@type' => 'MonetaryAmount',
                  'value' => '0',
                  'currency' => 'ZAR',
              ],
          ];
Hello @Pierre_P
as I have same issue
did you add the code above on ht_product_schema.php?
product_schema.JPG


Br
Omar
You do not have the required permissions to view the files attached to this post.
User avatar
Pierre_P
Contributor
Posts: 144
Joined: Fri Mar 12, 2021 5:06 am
Phoenix Version: v1.1.0.6
Has thanked: 21 times
Been thanked: 11 times

Re: Question about SCHEMA / header Module Offer or Product

Post by Pierre_P »

Omar_one wrote: Wed May 10, 2023 11:54 am did you add the code above on ht_product_schema.php?
Yes i did, just below

Code: Select all

$schema_product['offers']['availability'] = $availability;
Pls, you need to customize to your region!

Code: Select all

          $schema_product['offers']['shippingDetails'] = [
              '@type' => 'OfferShippingDetails',
              'shippingDestination' =>  [
                  '@type'  => 'DefinedRegion',
                  'addressCountry' => 'ZA',
              ],
          'deliveryTime' => [
                  '@type' => 'ShippingDeliveryTime',
              'cutoffTime' => '09:00:2Z',
              'businessDays' => [
                  '@type' => 'OpeningHoursSpecification',
                  'dayOfWeek' => [
                      'Monday',
                      'Tuesday',
                      'Wednesday',
                      'Thursday',
                      'Friday',
                  ],
              ],
              'handlingTime' => [
                  '@type' => 'QuantitativeValue',
                  'minValue' => '0',
                  'maxValue' => '1',
                  'unitCode' => 'd',
              ],
              'transitTime' => [
                  '@type' => 'QuantitativeValue',
                  'minValue' => '1',
                  'maxValue' => '5',
                  'unitCode' => 'd',
              ],
          ],
              'shippingRate' => [
                  '@type' => 'MonetaryAmount',
                  'value' => '0',
                  'currency' => 'ZAR',
              ],
          ];


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply