autoship_add_cart_item_data (function)

( src/cart.php) Adds the Autoship Schedule Data to Cart Item being added / updated. These values are also used to find a matching cart item in the cart. 

NOTE This is the first function to filter data being posted to add to cart.

Function

/**
 * Adds the Autoship Schedule Data to Cart Item being added / updated.
 * These values are also used to find a matching cart item in the cart.
 * NOTE This is the first function to filter data being posted to add to cart.
 *
 * @param array $cart_item_data extra cart item data we want to pass into the item.
 * @param int   $product_id ID of the product to add to the cart.
 * @param int   $variation_id ID of the variation to add to the cart.
 * @param int   $quantity The quantity being added
 *
 * @return array The updated cart item's data array.
 */
function autoship_add_cart_item_data( $cart_item_data, $product_id, $variation_id, $quantity ) {

	// Determine which global variable contains our data
	$values = !empty( autoship_get_item_data_schedule_hash( $_POST ) ) ? $_POST : $_REQUEST;
	return autoship_update_cart_item_data( $cart_item_data, $product_id, $variation_id, $quantity, $values );

}

Related

Still need help? Contact Us Contact Us