Announcement

Collapse
No announcement yet.

Default Item in cart

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Default Item in cart

    HI,

    I need to always have a default item in the cart, whenever users add an item from products page that will be the second product. but the user can delete the product if he wants..any help would be highly appreciated.

    Thanks

  • #2
    This would require you to do some custom programming. If you are familiar with this, here are the steps I would recommend:

    Use one of our hooks, probably: add_action( 'wpeasycart_cart_updated', your_function );

    You would want to probably use a session variable and if it is not set add the item to the cart. This can be done with:

    function your_function( ){
    $ec_db = new ec_db( );
    $ec_db->quick_add_to_cart( 'model_number' );
    }

    this requires that the product has no options. Otherwise you would have to dig deeper and use the full add_to_cart, which requires a lot more information.

    Comment

    Working...
    X