Skip to content

Instantly share code, notes, and snippets.

@kilbot
Last active May 14, 2019 05:46
Show Gist options
  • Save kilbot/be2ca463f50664569b938faa5baf92da to your computer and use it in GitHub Desktop.
Save kilbot/be2ca463f50664569b938faa5baf92da to your computer and use it in GitHub Desktop.
<?php
// this goes in your theme functions.php file
function my_custom_rest_dispatch_request($continue, $request, $route, $handler)
{
if (function_exists('is_pos') && is_pos() && $route == 'wc/v3/products') {
$request->set_param('per_page', -1);
$request->set_param('stock_status', 'instock');
}
return $continue;
}
add_filter('rest_dispatch_request', 'my_custom_rest_dispatch_request');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment