Product Variant not showing in Order

  • Posts: 303
  • Thank you received: 18
5 years 11 months ago #301859

-- HikaShop version -- : 3.5.1

Occasionally, I have been noticing some orders that are missing a product variant. E.g., we have replacement wings for a product. They come in either Left or Right. Product stock is set individually for each variant.



However, it seems that some orders come through without the variant. Is there any way to prevent the customer from ordering the non-variant version of the product? Still not sure how this is even possible, but it's occurring once or twice a day now and not consistently affecting a particular variant. To temporarily bypass this issue, we set the stock on the main product page to 0 and kept the variant stocks. However, this will show "out of stock" on the frontend for that particular product (even though there is stock within each variant).

Example URL: www.mojooutdoors.com/replacement-parts/p...category_pathway-200

I can provide more details if need be. I'm not sure it's a problem with the customization on that page, but I could be wrong. Didn't see any issues there.

Any thoughts?

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13376
  • MODERATOR
5 years 11 months ago #301871

Hi,

I don't see any issue with the customization of the page either and I'm not able to reproduce the problem. So I don't see either how that's possible unless I purposefully change the id of the product in the add to cart link of the page, but if it's everyday, I don't see why the customers would do that. One clever one might, but everyday different people, it means that the link to add to the cart they find is wrong and it's not the one on that product page link but somewhere else. Maybe the add to cart link is generated elsewhere, like if the product is a related product of another product and the related products listing has been customized to force the display of the add to cart button and not the "choose options" button when the product has variants. Or something similar could explain the situation.

Please Log in or Create an account to join the conversation.

  • Posts: 303
  • Thank you received: 18
5 years 11 months ago #301906

Located the problem. I have a small add to cart button on the product listing pages. It seems i am using the main link as the add to cart url for all products. Is there a way to either conditionally hide this if product variant or at the very least just redirect to the product page instead of add to cart link if the product has variant?

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13376
  • MODERATOR
5 years 11 months ago #301923

Hi,

To know if a product has just variants in the view files of the product listing will require some MySQL query and PHP processing. But you can easily know if a product has no variants and no options and no required custom item fields (the condition we use by default to display the add to cart button or the choose options button on the listings when you have "add to cart" display setting of your products listing menu/module activated) with such code:

if(empty($this->row->has_options)) {
 // no variants, no options, no required custom item fields
}else{
 // has variants or options or required custom item fields
}

Please Log in or Create an account to join the conversation.

Time to create page: 0.064 seconds
Powered by Kunena Forum