shopp_product_variant_set_taxed()

set whether or not a product, variant, or addon is taxable.

shopp_product_variant_set_taxed ( $variant, $taxed, $context )

@param int/Price $variant (required) The priceline id to set the tax setting 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 $taxed true to tax variant, false to not tax
@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

set whether or not a product, variant, or addon is taxable.

Example

// Product 33 priceline
$ProductPrice = shopp_product_variant(array('product'=>33), 'product');

// Set non-variant product 33 as non-taxed
shopp_product_variant_set_taxed ( $ProductPrice->id, false, 'product' );

// Variant of product 34
$Variant = 
    shopp_product_variant(
        array( 
            'product' => 34,
            'option' => array(
                'Color' => 'Black',
                'Size' => 'Large'
            )
        ),
        'variant'
    );

// Set Black/Large variant of product 34 as taxable
shopp_product_variant_set_taxed ( $Variant->id, true, 'variant' );

// Subscription addon for product 35
$Addon = 
    shopp_product_variant(
        array( 
            'product' => 35,
            'option' => array(
                'Extras' => 'Newsletter'
            )
        ),
        'addon'
    );

// Set subscription Addon of product 35 to non-taxable
shopp_product_variant_set_taxed ( $Addon->id, false, 'addon' );         

See Also

You must be logged in to post a comment.

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

Skip to toolbar