WC_Product_Variation::add_to_cart_url
Get the add to url used mainly in loops.
Method of the class: WC_Product_Variation{}
Hooks from the method
Returns
String.
Usage
$WC_Product_Variation = new WC_Product_Variation(); $WC_Product_Variation->add_to_cart_url();
WC_Product_Variation::add_to_cart_url() WC Product Variation::add to cart url code WC 10.8.1
public function add_to_cart_url() {
$url = $this->is_purchasable() ? remove_query_arg(
'added-to-cart',
add_query_arg(
array(
'variation_id' => $this->get_id(),
'add-to-cart' => $this->get_parent_id(),
),
$this->get_permalink()
)
) : $this->get_permalink();
return apply_filters( 'woocommerce_product_add_to_cart_url', $url, $this );
}