shopp_product_variant_set_shipping()

turn on/off shipping charges on a product, product variant, or product addon and set shipping settings (weight and dimensions)

shopp_product_variant_set_shipping ( $variant, $flag, $settings, $context )

@param int/Price $variant (required) The priceline id to turn setup the shipping settings on, or the Price object to change.  If Price object is specified, the object will be returned, but not saved to the database.
@param bool $flag (optional default:false) true for on, false for off. Turns on or off the shipping charges on the variant.  If false, settings are ignored.
@param array $settings array of shipping dimensions (weight => float, height => float, length => float, width => float)
@param string $context (optional default:variant) enforces the priceline is a 'product','variant', or 'addon'
@return bool/Price false on failure, true if Price saved, else the modified Price object.

Description

turn on/off shipping charges on a product, product variant, or product addon and set shipping settings (weight and dimensions)

Example

// Get the Large/Black variant of product 22
$LargeBlackVariant = shopp_product_variant(
    array('product'=>22,'option' =>
        array(
            'Color'=>'Black',
            'Size'=>'Large'
            )
        )
    );

// create setting array
// units are setup in your shipping settings in the Admin
$ship_settings = array(
    'weight' => 20.1, 
    'width' => 15,
    'length' => 25,
    'height' => 10
);

// enable shipping costs on product and set weight/dimension
shopp_product_variant_set_shipping ( $LargeBlackVariant->id, true, $ship_settings, 'variant' )

See Also

You must be logged in to post a comment.

© Ingenesis Limited. Shopp™ is a registered trademark of Ingenesis Limited.

Skip to toolbar