Post by opensource » Thu Jan 20, 2022 4:48 pm

Hi there,

I'm looking for a solution on how to sit a product in visitor's cart once he first visits my store. In other words, you open my store and there is a product already in your cart. And I likely gonna have only a single product in my store, I guess.

Is there a module for that?

Newbie

Posts

Joined
Wed Dec 23, 2020 5:44 am
Location - Lithuania

Post by thekrotek » Thu Jan 20, 2022 5:02 pm

You can do this with a simple JS script, which will execute cart.add() function on page load with predefined product ID and quantity.

Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com


User avatar
Expert Member

Posts

Joined
Sun Jul 03, 2016 12:24 am


Post by xxvirusxx » Thu Jan 20, 2022 5:04 pm

opensource wrote:
Thu Jan 20, 2022 4:48 pm
In other words, you open my store and there is a product already in your cart.
And how you know what product want the customer?

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by opensource » Thu Jan 20, 2022 5:10 pm

xxvirusxx wrote:
Thu Jan 20, 2022 5:04 pm
opensource wrote:
Thu Jan 20, 2022 4:48 pm
In other words, you open my store and there is a product already in your cart.
And how you know what product want the customer?
Let's assume I'm going to have only one product in my shop :)

Newbie

Posts

Joined
Wed Dec 23, 2020 5:44 am
Location - Lithuania

Post by opensource » Thu Jan 20, 2022 5:11 pm

thekrotek wrote:
Thu Jan 20, 2022 5:02 pm
You can do this with a simple JS script, which will execute cart.add() function on page load with predefined product ID and quantity.
That would be terrific. I'll give it a go. Thank you bunches.

Newbie

Posts

Joined
Wed Dec 23, 2020 5:44 am
Location - Lithuania

Post by straightlight » Thu Jan 20, 2022 9:40 pm

xxvirusxx wrote:
Thu Jan 20, 2022 5:04 pm
opensource wrote:
Thu Jan 20, 2022 4:48 pm
In other words, you open my store and there is a product already in your cart.
And how you know what product want the customer?
It may not be required by customers. A default product can also be defined as a store-interest strategy rather than the customer when creating an account with customer groups, for instance. This could be easily accomplished with an Event Trigger.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by straightlight » Thu Jan 20, 2022 9:41 pm

opensource wrote:
Thu Jan 20, 2022 5:11 pm
thekrotek wrote:
Thu Jan 20, 2022 5:02 pm
You can do this with a simple JS script, which will execute cart.add() function on page load with predefined product ID and quantity.
That would be terrific. I'll give it a go. Thank you bunches.
Now that the issue has been solved, please add: [SOLVED] at the beginning of the subject line on your first post.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: No registered users and 47 guests