commerce icon indicating copy to clipboard operation
commerce copied to clipboard

[4.x]: Unable to reset config value to craft default

Open samhibberd opened this issue 9 months ago • 4 comments

What happened?

After recently changing a setting in the commerce general settings in the control panel (we very rarely change settings in this way), I noticed a bunch of changes in the project.ymal, it saved all the values from my commerce config file to this file.

Subsequently removing / commenting out a config value from the commerce config file, like pdfPaperSize:

return [
    'pdfAllowRemoteImages' => true,
    // 'pdfPaperSize' => 'a4',
];

The config setting when accessed via php or twig, remains a4 rather than reverting to the default letter which I would expect to be the default behavior?

Resaving the commerce General Settings does not fix this.

Could this be related to any changes here - https://github.com/craftcms/commerce/issues/3632

Craft CMS version

4.13.10

Craft Commerce version

4.7.2

PHP version

No response

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

samhibberd avatar May 13 '25 11:05 samhibberd

I could not reproduce what you are seeing. I added:

<?php

return [
    'pdfPaperSize' => 'a4',
];

in commerce.php and in my pdf template I put:

{{ craft.app.plugins.getPlugin('commerce').settings.pdfPaperSize }}

which returned a4 (I have 'letter' in my project config).

When I commented it out:

<?php

return [
//    'pdfPaperSize' => 'a4',
];

The pdf returned 'letter'.

Could you try again and let me know?

lukeholder avatar May 19 '25 10:05 lukeholder

Just to confirm, did you save the Commerce > General Settings before you commentend out pdfPaperSize?

samhibberd avatar May 19 '25 11:05 samhibberd

@samhibberd I will give it another test now and let you know.

lukeholder avatar May 28 '25 12:05 lukeholder