WC_Product_Variation::add_to_cart_url()

Get the add to url used mainly in loops.


Description Description


Return Return

(string)


Top ↑

Source Source

File: includes/class-wc-product-variation.php

	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 );
	}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.