Rest Api /products/slots/ cannot get slots from the past #340
Labels
priority: low
The issue/PR is low priority—not many people are affected or there’s a workaround, etc.
type: enhancement
The issue is a request for an enhancement.
What I expected
I want to be able to view all slots back to the
$min_date
, regardless of whether it is in the past.There is a
$get_past_times
param which makes it look like it is possible, but that is just a holdover from the underlying plugin. (Update: see my reply below, this does actually seem to be the key to this working)I am building an admin utility for a client and I need to be able to display historical slots.
It is just three lines of code that are stopping this, and without it, I have to adopt hundreds of lines of code into my admin plugin, and maintain it.
File:
wp-content/plugins/woocommerce-bookings/includes/api/class-wc-bookings-rest-products-slots-controller.php
That
if
statement just simply needs to check if the$allow_past_slots
param is false & (the rest of its check).What happened instead
The slots are clamped to only show the minimum bookable date for the product.
Instead I have had to store a hash of the file in my plugin, and I'm comparing it to alert me to if there are ever any changes to the WC Bookings Accommodation plugin in the future.
I've had to adopt 300 lines of code from the plugin into mine to recreate this rest api with the fix applied.
This isn't ideal from an ongoing site stability viewpoint, as I now have to maintain it for the clients site to stay functional.
Steps to reproduce the issue
The text was updated successfully, but these errors were encountered: