Ship to address
Ship products directly to an address with the Direct Send send method.
When you already know the address you want to send an order to, you can use Goody to ship directly to that address using the Direct Send send method (direct_send
).
There are two things to be aware of when using direct send:
- You’ll enter the address of the recipient in the
mailing_address
field of the recipient object. - If a product in your cart has variants, you must specify the variants to send.
Specifying the mailing address
To specify the mailing address, you’ll need to add a mailing_address
object to the recipient object. Here’s an example:
Specifying variants
When sending a gift with Goody, you don’t need to specify the variants since the recipient can select the variants on their own. However, when sending with Direct Send, we need to know which variant to send to the recipient, so you’ll need to specify the variant.
If a product has no variants (variants_num_selectable
is null or zero), you don’t need to specify any variants.
Variants data
When retrieving products from the product catalog, you’ll see the following information in the product object:
variants_label
tells you the name of the variant. This can be something like Size, Flavor, Color, etc.
variants_num_selectable
tells you how many variants can be selected. This is the expected length of the variants
array that you pass into the cart item. Typically, this is 1, but some products let you select more than one variant, such as a 3-pack of cookies. If this is null or 0
, then you don’t need to specify any variants.
variants
shows you the data for each variant. You’ll use the name
field of the variant when passing variants in the cart item.
Adding variants to the cart item
Let’s say that the product has variants_num_selectable
equal to 1
, so we must specify one variant in the cart item. Our cart item now looks like this:
Now, if we had a product with variants_num_selectable
equal to 3
, then we must specify three variants in the cart item. Our cart item now looks like this:
You can specify the same variant more than once.
Example direct send payload
This payload will send a direct send gift to the specified recipient. This product is a pack of cookies with a single variant selection (variants_num_selectable
is 1
).