Update the cycle of the users to few days ago, than for the date to be updated to the day before the order instead of the day of the order when purchased the product, replace the line:
update_user_meta( $user_id, 'cycle', $order->get_date_created()->date( 'Y-m-d' ) );
With:
update_user_meta( $user_id, 'cycle', date( 'Y-m-d', strtotime( $order->get_date_created()->date( 'Y-m-d' ) . ' - 1 day' ) ) );
hi condless
thanks for the response i really appreciated it.
btw the code you provided is not working. it won’t update the cycle date.
Hi, the code should work, can you try to modify the user’s cycle into 2020-08-09 manually and than purchase the product?
hi
i set the cycle to 2020-08-09
then i created a post, the limitation is working correctly. https://prnt.sc/uxzjxz
when i try to purchased it change the date. but not the limitation still 2/2 https://prnt.sc/uxzmwc
i try to used the original code from documents.
the cycle date was changed and the limit is change to 0/2, however when i submitted a post its not updating, still 0/2 after submitted a post. https://prnt.sc/uxzpcm
-
This reply was modified 5 years, 7 months ago by
reynskie.
Hi,
As described via Email, the code in the docs was updated so the reset will happen only by the end of the day of the purchase. The purpose is to prevent the incorrect posts calculation.