Automattic\WooCommerce\StoreApi\Routes\V1
CartCoupons::prepare_links
Prepare links for the request.
Method of the class: CartCoupons{}
No Hooks.
Returns
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() CartCoupons::prepare links code WC 10.5.0
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;
}