MarketPress single product and add to cart functions

Hi guys,

I’m looking through the MarketPress plugin for some code that will:

a) add a product to the shopping cart (as in add_product(product_id);

b) display a single product listing with title, description, image, variation, price, and an “add to cart” button

They seem like pretty essential e-commerce functions… do these functions exist anywhere? Can you offer some help getting started creating them myself?



  • pro120
    • Design Lord, Child of Thor

    There isn’t an add_to_cart() function. Cart additions and subtractions are handled with the update_cart() function in marketpress.php. I’m sure there might be a shortcode to handle the listing functionality you are looking for but if you aren’t looking for shortcodes you should take a peak at the /includes/template-functions.php file. This houses functions that available in your specific theme like mp_buy_button() etc. Hopefully that puts you on the right track.

  • daveoutdoor
    • Flash Drive

    Yeah, as i mentioned, I already searched through the plugin files, including the template-functions.php, and saw that there’s no add_to_cart function – hence the posting looking for input.

    I should have been more specific: how is the ‘add to cart’ handled? I see it updates a cookie, and then the cookie is processed on the shopping cart page? If one of the programmers could quickly explain how to use the update_cate() function, or outline the cookie handling process and where/what functions are responsible, that would be helpful!

    I’m kind of surprised nobody else has posted/is looking for a programmatic “add to cart” solution… seems like a no-brainer.

    I’d really appreciate some deeper insight :slight_smile: Thanks in advance!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.