[Skip to main content](#vessel-content)

#   Restrict Product Combinations

##

- **[Devine](/forum/user/2915-devine "View Devine's Profile")**
- [![Devine's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/2915-devine "View Devine's Profile") Topic Author
- [ Offline](/forum/user/2915-devine)

Less More

- Posts: 62
- Thank you received: 0
-
-

14 years 3 months ago [\#60963](#60963) by [Devine](/forum/user/2915-devine "View Devine's Profile")  *[Restrict Product Combinations](/forum/4-how-to/60963-restrict-product-combinations#60963 "I have a subscription product type which requires a specific payment type setup to do recurring direct debits. Because of this I need to restrict this product from being purchased with other normal...")* was created by *[Devine](/forum/user/2915-devine "View Devine's Profile")*

I have a subscription product type which requires a specific payment type setup to do recurring direct debits. Because of this I need to restrict this product from being purchased with other normal payment type products. Since the payment type is determined by the Shipping Method I am trying to determine an appropriate way to restrict the available Shipping Methods based on the products in the cart. I seem to be coming up a little short on finding a solution that works for all or even most cart combinations. The key really is just that if the subscription product is in the cart then no other products should be.

If I make the weight on the subscription large and the shipping method for large weights this works in part. It stops the subscription shipping method from being displayed on most cart combos and shows it when the subscription product is in the cart. But does not stop other products form then being added because it just adds to the weight. If you then put upper limits it stops multiple subscriptions being added to the cart. The same sort of problems exist if I try anything to do with price.

Do you have any other ideas?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzYwOTYzLXJlc3RyaWN0LXByb2R1Y3QtY29tYmluYXRpb25zP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86593
- Thank you received: 14334
-
-

14 years 3 months ago [\#61045](#61045) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: Restrict Product Combinations](/forum/4-how-to/60963-restrict-product-combinations#61045 "I have a subscription product type which requires a specific payment type setup to do recurring direct debits. Because of this I need to restrict this product from being purchased with other normal...")*

Hi,

You won't be able to restrict payment methods per products based on a characteristic which has to be used for shipping fees.
You should just add a check on the file 'cart' of the 'checkout' view via the menu Display-&gt;Views and add such code: Code:

$sub_found=false; $other_products=false; foreach($this-&gt;products as $product){ if($product-&gt;cart_product_quantity&gt;0){ if($product-&gt;product_code=='My_subscription_product') $sub_found= true; else $other_products = true; } } if($sub_found &amp;&amp; $other_products){ $app =&amp; JFactory::getApplication(); $app-&gt;enqueueMessage('Not possible'); $this-&gt;nextButton = false; }

The following user(s) said Thank You: [Devine](/forum/user/2915-devine "View Devine's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzYwOTYzLXJlc3RyaWN0LXByb2R1Y3QtY29tYmluYXRpb25zP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[FransG](/forum/user/71066-fransg "View FransG's Profile")**
- [![FransG's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/71066-fransg "View FransG's Profile")
- [ Offline](/forum/user/71066-fransg)

Less More

- Posts: 2
- Thank you received: 0
-
-

3 years 9 months ago [\#349219](#349219) by [FransG](/forum/user/71066-fransg "View FransG's Profile")  Replied by *[FransG](/forum/user/71066-fransg "View FransG's Profile")* on topic *[Restrict Product Combinations](/forum/4-how-to/60963-restrict-product-combinations#349219 "I have a subscription product type which requires a specific payment type setup to do recurring direct debits. Because of this I need to restrict this product from being purchased with other normal...")*

HI,

I have about the same question, how to stop product combinations.

I have a subscription product type which requires a specific payment type setup to do recurring direct debits. Because of this I need to restrict this product from being purchased with other normal payment type products. Since the payment type is determined by the Shipping Method I use a warehouse to make the distinction. However I still have some challenges with my payment provider. Therefore I'm searching for a way to prevent a combination of the two products.

Is the solution below stil viable (now @ version 4.7.1) as it looks like e different structure is used now? Or can you give me a better direction to look into?

Kind regards,
Frans

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzYwOTYzLXJlc3RyaWN0LXByb2R1Y3QtY29tYmluYXRpb25zP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86593
- Thank you received: 14334
-
-

3 years 9 months ago [\#349272](#349272) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Restrict Product Combinations](/forum/4-how-to/60963-restrict-product-combinations#349272 "I have a subscription product type which requires a specific payment type setup to do recurring direct debits. Because of this I need to restrict this product from being purchased with other normal...")*

Hi,

The solution above is not possible anymore. This was with the old checkout system which was removed in HikaShop 4.0.0

Warehouses won't allow you to restrict the products in the cart.
If you want that the customers can't add another product in the cart when they add that product, I think you could use the limits system.
For example, you could set a weight of 99 999 kg for that product. Then, create a limit ( in the menu Products&gt;Limits ) restricted to the "cart" with a max weight of 99 999 kg.
That way, when other products are in the cart, you won't be able to add this product to the cart. And when this product is in the cart, you won't be able to add other products as long as they don't have a weight of 0.

Alternatively, it's also possible to develop a custom plugin to prevent the add to cart based on custom conditions, implementing the onBeforeProductQuantityCheck event. We actually recently used that event in plugins/hikashop/shopclosehours.php to allow merchants to prevent users from being able to add some or all products to the cart base on the hour of the day:
[ www.hikashop.com/home/blog/492-hikashop-4-7-1.html#close](https://www.hikashop.com/home/blog/492-hikashop-4-7-1.html#close)

The following user(s) said Thank You: [FransG](/forum/user/71066-fransg "View FransG's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzYwOTYzLXJlc3RyaWN0LXByb2R1Y3QtY29tYmluYXRpb25zP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[FransG](/forum/user/71066-fransg "View FransG's Profile")**
- [![FransG's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/71066-fransg "View FransG's Profile")
- [ Offline](/forum/user/71066-fransg)

Less More

- Posts: 2
- Thank you received: 0
-
-

3 years 9 months ago [\#349293](#349293) by [FransG](/forum/user/71066-fransg "View FransG's Profile")  Replied by *[FransG](/forum/user/71066-fransg "View FransG's Profile")* on topic *[Restrict Product Combinations](/forum/4-how-to/60963-restrict-product-combinations#349293 "I have a subscription product type which requires a specific payment type setup to do recurring direct debits. Because of this I need to restrict this product from being purchased with other normal...")*

HI Nicolas,

Thanks for the elaborate answer including alternatives, much appreciated. I will have a look into it to find my solution.

Cheers,
Frans

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzYwOTYzLXJlc3RyaWN0LXByb2R1Y3QtY29tYmluYXRpb25zP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.070 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
