Automattic\WooCommerce\StoreApi\Routes\V1

CartCoupons::prepare_links()protectedWC 1.0

Prepare links for the request.

Method of the class: CartCoupons{}

No Hooks.

Return

Array.

Usage

// protected - for code of main (parent) or child class
$result = $this->prepare_links( $coupon_code, $request );
$coupon_code(string) (required)
Coupon code.
$request(\WP_REST_Request) (required)
Request object.

CartCoupons::prepare_links() code WC 9.3.3

protected function prepare_links( $coupon_code, $request ) {
	$base  = $this->get_namespace() . $this->get_path();
	$links = array(
		'self'       => array(
			'href' => rest_url( trailingslashit( $base ) . $coupon_code ),
		),
		'collection' => array(
			'href' => rest_url( $base ),
		),
	);
	return $links;
}