add_action( 'rest_api_init', 'custom_cart_endpoint' ); function custom_cart_endpoint() { register_rest_route( 'wc-api/my-custom-cart/v1', '/cart', [ 'methods' => 'GET', 'callback' => 'get_cart_data', ] ); } function get_cart_data() { }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter