Dynamic product showing as unavailable

Solved
garethrane
Excursionist
20 0 2

Hi all,

 

I have a product in that we are using as a source product to create custom products based on user input suggestions. Once created the user is redirected to the cart with the newly created product added to it.

 

However these dynamic products are showing as unavailable and as such I am unable to complete the checkout process.

 

I noticed that when creating these products and I view them in Shopify admin that they are not attached to a sales channel. Is there something I need to do in relation to that?

 

Here is how I am creating the product:

 

'product' => array(
	"title" => $product_title,					
	"product_type" => "Cut To Size",
	"published"=> false,
	'variant'=> array(				        
        'price' => $product_price_per_item,
        'fulfillment_service' => 'manual',
        'inventory_management' => null,
        "inventory_quantity" => $quantity				        
    )
)

Any help would be greatly appreciated.

0 Likes
SBD_
Shopify Staff
Shopify Staff
1044 141 185

This is an accepted solution.

Hey @garethrane 

 

You'll need to publish the product to that specific sales channel. Some pointers here: https://community.shopify.com/c/Shopify-APIs-SDKs/Sales-channel-visibility-via-API/m-p/657980/highli...

 

Let me know if you get stuck.

garethrane
Excursionist
20 0 2

@SBD_ thank you for this. I only need the product to be available to the customer that created it. If I add this product to a sales channel will it be available to the customer while not being available to anyone else?

0 Likes
SBD_
Shopify Staff
Shopify Staff
1044 141 185

If I add this product to a sales channel will it be available to the customer while not being available to anyone else?

Others would need some way to discover the variant ID before they could add it to cart.

0 Likes
garethrane
Excursionist
20 0 2

@SBD_ when a customer creates a product it automatically gets added to their cart. This product variant will just be for that customer as it will be for their specific requirements. Therefore we need them to be able to complete the checkout process with the product but we do not want this product being added to the shop catalog for other to see.

0 Likes
SBD_
Shopify Staff
Shopify Staff
1044 141 185

@garethrane on second thoughts, the draft order API might be better suited - it allows custom line items:

 

https://shopify.dev/docs/admin-api/rest/reference/orders/draftorder?api[version]=2020-04#create-2020...

0 Likes