Offer not saved with price 0

Created on 2 September 2020, over 4 years ago
Updated 19 July 2024, 5 months ago

Problem/Motivation

I am creating a new schema for Software Application using the Offers Base and cannot save a price of 0.

Google requires this field and says

If the app is free of charge, set offers.price to 0.

Steps to reproduce

Use a schema with 'Offer' field, enter 0 as price and save. Data is deleted due to

<?php
'#default_value' => !empty($value['price']) ? $value['price'] : '',
?>

in SchemaOfferTrait.php

Proposed resolution

Numeric values should use isset or is_null instead of empty when 0 is allowed.

🐛 Bug report
Status

Fixed

Version

1.0

Component

Existing structures

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇧🇪Belgium gillesbailleux La Roche-en-Ardenne

    Please pardon me to reopen this issue but the very same problem is back when creating an event with a free entrance fee. When trying to put a zero for the price, the value does not appear in the source code.

    The D10.3.1 website uses PHP 8.3.9 and it is equipped with the schema_metatag 3.0.2 release.

Production build 0.71.5 2024