Skip to content
💸 Introductory Pricing: Save 50% on bundle plans for your first year Get deal

How to add to cart via URL

Sunshine Photo Cart has a "hidden" feature that allows you to send a link to a customer prefilled with information for a specific image + product to be added to cart. Here is a sample URL:

https://yourdomain.com/client-galleries/?sunshine_action=add_to_cart&product_id=PRODUCT_ID&image_id=IMAGE_ID&qty=2

This uses what are known as URL Parameters to pass extra data to a page. With this URL, I am passing 4 URL Parameters:

  • sunshine_action (with a value of "add_to_cart")
  • product_id
  • image_id
  • qty

How to find the IDs for products and images

To find a Sunshine Photo Cart Product ID, edit the product and look in the address bar of your browser. You will see the "post" URL parameter - this is your Product ID.

Screenshot showing product id in URL when editing
Product ID is 64 in this case

To find the Image ID, go to the gallery the image is in and click on the "Edit" pencil icon. Then, same as the product, find the "post" URL parameter to get the unique Image ID.

Screenshot showing where the edit icon for an image is
Screenshot showing where to get the image id from the URL
Image ID is 2269 in this case

How to send customer to checkout

The main part of the URL can actually be anything you want and in the first example I used my main Client Galleries page. You may want to have the user end on a specific page like the Checkout for a fast, quick purchase.

https://yourdomain.com/client-galleries/checkout/?sunshine_action=add_to_cart&product_id=PRODUCT_ID&image_id=IMAGE_ID&qty=2

In this example I used the URL to my Checkout page instead of the main Client Galleries.

How to include a discount code

With the Discounts add-on enabled, you can also pass a discount query variable:

https://yourdomain.com/client-galleries/checkout/?sunshine_action=add_to_cart&product_id=PRODUCT_ID&image_id=IMAGE_ID&qty=2&discount=CODE

The discount code will automatically be applied to the cart.

Still need help?

If you have not yet found your answer in the documentation articles, please contact support