Skip to main content

Availability of bill-of-materials products in the shipping costs module

Since the availability of a bill of materials results from the availability of its sub-products, you cannot use the variable d.instock in the shipping costs module of Shopware (e.g. to calculate shipping costs). To use the correct availability of the bill of materials based on the sub-products, you can use the following query:

IF(
AT.viison_setarticle_active,
(
SELECT
MIN(sad.instock div savs.quantity) AS instock
FROM
s_articles_details AS sad
LEFT JOIN s_articles_viison_setarticles AS savs ON sad.id = savs.articledetailid
WHERE
savs.setid = d.id
),
IF(
v.instock IS NOT NULL, v.instock, d.instock
)
) AS instock
Did this answer your question?