Forum

Thread tagged as: Question, Problem, Shop

Perch Shop Product Still Thinks it has Variants

Hi,

I have a product inPerch Shop which was showing in the product listing with a direct 'add to cart' button. After adding variants / options for the product this button disappeared and only a 'read more' was showing so you are redirect to then select the variant / option first before adding to cart.

This is fine and as expected.

However, after deleting the variants / options, the direct 'add to cart' button still won't show up, which makes me think that there is still something in the database that is saying there are still variants on it. I've checked through admin and cannot see anything that I haven't deleted or unchecked so wondered if you know what I may have done wrong?

The product listing template is as follows, explaining why the button comes off when variants are selected:


<p><a href="/shop/products/index.php?product=<perch:shop id="slug" type="slug" />">Read More...</a></p> <perch:if not-exists="has_variants"> <perch:form id="add_to_cart" app="perch_shop" action="/shop/cart.php"> <perch:input id="product" type="hidden" value="<perch:shop id="productID" env-autofill="false" />" /> <perch:input type="submit" value="Add to cart" /> </perch:form> </perch:if>

I'm running Shop 1.0.1

Thanks, Alex

Alex Bennett

Alex Bennett 0 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

What's the value of has_variants in <perch:showall />?

Is there a reason you can't run the current version of Shop?

Hi Dean - thanks for your reply.

I've updated Perch and the shop app now so it's the latest version. Sorry should have done so before.

The problem is still there, but I've added <perch:showall /> to the template and the table next to the two affect products both show a value of '1' for productHasVariants, whereas the others that are okay are showing a '0'.

I'm happy to go into the database and change this value back to '0', but can you confirm this won't cause an issue elsewhere, or if maybe there's something I didn't do right when deleting the options?

Thanks, Alex

Drew McLellan

Drew McLellan 2638 points
Perch Support

That won't cause an issue. I think it's a bug - it looks like there's never a single point which triggers that field to be set back to 0. We should check after deleting a variant.

No probs, thanks for the advice - I'll just manually update it in the database for now!

Cheers, Alex

Drew McLellan

Drew McLellan 2638 points
Perch Support

This should be fixed for 1.0.7

That's great - thanks!