craftcms / commerce

Fully integrated ecommerce for Craft CMS.
https://craftcms.com/commerce
Other
226 stars 170 forks source link

[5.x]: Invalid purchasable ID in CP create order when order set to site with no products #3756

Open bartdigitalpulse opened 2 hours ago

bartdigitalpulse commented 2 hours ago

What happened?

Description

I have a setup of 8 sites (in admin/settings/sites) where 4 of them use commerce. So only 4 of them have products enabled for their site in admin/commerce/settings/producttypes. The primary site is a site that uses products and commerce.

When I start a new order in the CP the default selected site is a non commerce, non product site. It's probably sorted by Id? I would expect this to be primary site. Every time I start a new order I need to change it manually to the primary site.

When that first non commerce site is selected I'm still able to search products in the add line item. When I try to add them then I get the Invalid purchasable ID because the product is not available for that site.

Image

Steps to reproduce

  1. See above

Expected behavior

Set primary site as default order site. Don't show products if they are not enabled for the current order site

Actual behavior

First site by id is the default order site. You can search and display products even if they are not enabled for that site.

Craft CMS version

Craft Pro 5.4.10.1

Craft Commerce version

5.2.2

PHP version

8.2.6

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

-

linear[bot] commented 2 hours ago

PT-2306 [5.x]: Invalid purchasable ID in CP create order when order set to site with no products