Add a product to the cart
Use this action to add a product to your Picnic shopping cart. You can add a product either by its product ID or by a product name. When you add a product by name, Picnic searches for it and adds the first result to your cart.
This is handy for automations, for example, to top up your cart with a staple like milk or coffee on a schedule, so it is ready the next time you place an order.
Using this action from the user interface
If you prefer building automations and scripts visually, Home Assistant walks you through this action step by step. You pick what to target, tweak a few options, and save. No YAML knowledge required.
To add a product to your cart from an automation or a script:
- Go to Settings > Automations & scenes.
- Open an existing automation or script, or select Create automation > Create new automation.
- If you’re setting up a new automation, add a trigger in the When section. Scripts don’t need a trigger. They run when something else calls them.
- In the Then do section, select Add action.
- From the search box, search for and select Picnic: Add a product to the cart.
- Select the Picnic service to add the product to, then provide a product ID or a product name.
- Select Save.
This action does not support targets. In the UI, you are not prompted to choose an area, device, entity, or label.
Options in the UI
The product name to search for. The first search result is added to the cart.
Using this action in YAML
If you work directly in YAML, or you want to know exactly what Home Assistant does under the hood, this section has the technical reference. It lists the field names you use in YAML, their types, and which ones are required.
In YAML, refer to this action as picnic.add_product. A basic example looks like this:
action: picnic.add_product
data:
config_entry_id: 6b4be47a1fa7c3764f14cf756dc9899d
product_name: "Picnic cola zero"
This searches for “Picnic cola zero” and adds the first result to your cart.
Options in YAML
The configuration entry ID of the Picnic service to add the product to.
Good to know
- Provide either a product ID or a product name, not both. The two are mutually exclusive.
- When you add a product by name, the first search result is added to your cart.
- The action fails when no matching product can be found, or when neither a product ID nor a product name is provided.
Try it yourself
Ready to test this? Open Developer tools > Actions, search for this action, fill in the fields, and select Perform action. You see what happens on your actual entitiesAn entity represents a sensor, actor, or function in Home Assistant. Entities are used to monitor physical properties or to control other entities. An entity is usually part of a device or a service. [Learn more] without writing a line of YAML.
More examples
Real scenarios where this action shows up in automations and scripts. Copy any example and adapt it to your setup.
You don’t need to edit YAML to use these examples. Copy a YAML snippet from this page, open the automation editor in Home Assistant, and press Ctrl+V (or Cmd+V on Mac). Home Assistant automatically converts the pasted YAML into the visual editor format, whether it’s a full automation, a single trigger, a condition, or an action.
Automation: add coffee to the cart every Monday
Add a bag of coffee to your Picnic cart at the start of each week, so it is ready for your next order.
- Trigger: Every Monday at 09:00
- Action: Picnic: Add a product to the cart
YAML example for adding coffee every Monday
alias: "Add coffee to the Picnic cart"
triggers:
- trigger: time
at: "09:00:00"
conditions:
- condition: time
weekday:
- mon
actions:
- action: picnic.add_product
data:
config_entry_id: 6b4be47a1fa7c3764f14cf756dc9899d
product_name: "Coffee beans"
Still stuck?
The Home Assistant community is quick to help: join Discord for real-time chat, post on the community forum with the action you’re calling and what you expected to happen, or share on our subreddit /r/homeassistant.
AI assistants like ChatGPT or Claude can also explain actions or suggest the right one when you describe what you want in plain language.