Skip to content

Include shipping weight details in product data - #107

Merged
davidwindell merged 9 commits into
outeredge:masterfrom
Andrew998:Include-Shipping-Weght
Aug 25, 2026
Merged

Include shipping weight details in product data#107
davidwindell merged 9 commits into
outeredge:masterfrom
Andrew998:Include-Shipping-Weght

Conversation

@Andrew998

Copy link
Copy Markdown
Contributor

Added shipping weight details for Google Merchant, formatted as a string with 6 decimal places. Included condition to check for product weight before adding to data.

Added shipping weight details for Google Merchant, formatted as a string with 6 decimal places. Included condition to check for product weight before adding to data.
@vseager

vseager commented Feb 25, 2026

Copy link
Copy Markdown
Contributor

@Andrew998 Thanks for the contribution. This should respect the module config:

$this->getConfig('structureddata/product/include_weight')

Also, why rounding to 6 decimal places? Magneto rounds to 4 decimal places, so this seems unnecessary.

@Andrew998

Copy link
Copy Markdown
Contributor Author

Thanks. I'm not too familiar with coding for Magento so all comments are welcome.

Is the process that I make those changes to the contribution?

@vseager

vseager commented Feb 25, 2026

Copy link
Copy Markdown
Contributor

Hi Andrew,

Yes please go ahead and update your merge request and we will review it again for you. If not, we can put it in our roadmap to implement at a later date.

…y weight.

Updated weight formatting to use 4 decimal places instead of 6. Update check for display weight.
Corrected comment to specify weight formatting with 4 decimal places.
@vseager

vseager commented Feb 25, 2026

Copy link
Copy Markdown
Contributor

The latest commit removes the check for a valid weight on the product. As well as checking if the config allows weight to be included, you must still check that a weight existing on the product. See the short description as an example of this logic.

Add weight check to include shipping details for products.
@Andrew998

Copy link
Copy Markdown
Contributor Author

Thank you. I'll get there eventually!

@Andrew998
Andrew998 marked this pull request as draft June 3, 2026 13:27
@Andrew998
Andrew998 marked this pull request as ready for review June 3, 2026 13:28
@Andrew998
Andrew998 marked this pull request as draft August 7, 2026 12:22
Updated weight formatting to use 6 decimal places instead of 4.

@Andrew998 Andrew998 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is ready for review. Shipping weight is the one thing missing for Google Merchant account to pick up all details without needing a feed.

@Andrew998
Andrew998 marked this pull request as ready for review August 7, 2026 12:31
Comment thread Model/Type/Product.php Outdated
Comment thread Model/Type/Product.php Outdated
Comment thread Model/Type/Product.php Outdated
@kilo-code-bot

kilo-code-bot Bot commented Aug 7, 2026

Copy link
Copy Markdown

Code Review Summary

Status: 1 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
Model/Type/Product.php 374 Shipping details are emitted when the product weight is unset.
Files Reviewed (1 file)
  • Model/Type/Product.php - 1 issue

Fix these issues in Kilo Cloud

Previous Review Summaries (3 snapshots, latest commit 8b6e8fe)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 8b6e8fe)

Status: 1 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
Model/Type/Product.php 374 Shipping details are emitted when the product weight is unset.
Files Reviewed (1 file)
  • Model/Type/Product.php - 1 issue

Fix these issues in Kilo Cloud

Previous review (commit 9111ccd)

Status: 3 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 3
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
Model/Type/Product.php 374 The new shipping-details output bypasses the existing include_weight configuration.
Model/Type/Product.php 375 The code uses four decimal places while the change claims six.
Model/Type/Product.php 378 weight is not a valid property of OfferShippingDetails, so consumers will not receive a schema-valid shipping weight.
Files Reviewed (1 file)
  • Model/Type/Product.php - 3 issues

Fix these issues in Kilo Cloud

Previous review (commit bb689e3)

Status: 3 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 3
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
Model/Type/Product.php 374 The new shipping-details output bypasses the existing include_weight configuration.
Model/Type/Product.php 375 The code uses four decimal places while the change claims six.
Model/Type/Product.php 378 weight is not a valid property of OfferShippingDetails, so consumers will not receive a schema-valid shipping weight.
Files Reviewed (1 file)
  • Model/Type/Product.php - 3 issues

Fix these issues in Kilo Cloud


Reviewed by gpt-5.6-luna · Input: 24 · Output: 5.6K · Cached: 125.8K

@davidwindell

Copy link
Copy Markdown
Member

Should this be using QuantitativeValue? i.e. something like:

if ($product->getWeight() !== null && $product->getWeight() !== '') {
    $data['shippingDetails'] = [
        '@type' => 'OfferShippingDetails',
        'weight' => [
            '@type' => 'QuantitativeValue',
            'value' => (float)$product->getWeight(),
            'unitText' => $this->getConfig('general/locale/weight_unit')
        ]
    ];
}

@Andrew998

Copy link
Copy Markdown
Contributor Author

I don't believe so. I have been using it as it is for 6 months now and Google Merchant Centre now lists all products as fully approved without having to provide a feed. Without this addition, they are not fully approved.

@davidwindell

Copy link
Copy Markdown
Member

The official spec claims it is required, so it would be best to migrate to that format.

https://schema.org/OfferShippingDetails

Please also add the same check used elsewhere to gate this logic:

if ($this->getConfig('structureddata/product/include_weight')) {

Then this should be good for merge.

@Andrew998

Copy link
Copy Markdown
Contributor Author

Thank you. I will do some further testing and check it all works.

Updated check for showing and using new QuantativeValue format.
Comment thread Model/Type/Product.php Outdated
@Andrew998

Copy link
Copy Markdown
Contributor Author

I believe this is now good to go.

@outeredge outeredge deleted a comment from kilo-code-bot Bot Aug 25, 2026
Updated condition to include weight only if it is set and not null or empty.
@davidwindell
davidwindell merged commit e64589d into outeredge:master Aug 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants