get-last-completed-orders-api-route ( Mihai )

add_action(‘rest_api_init’, function () { register_rest_route(‘sg24tothemoon/v1’, ‘/completed-orders’, array( ‘methods’ => ‘GET’, ‘callback’ => ‘get_recently_completed_orders_json’, ‘permission_callback’ => ‘__return_true’, // Adjust this for security in production )); }); function get_recently_completed_orders_json(WP_REST_Request $request) { global $wpdb; // Access the global WordPress database object $hours =…Continue reading

remove add to cart from free product page ( Mihai )

/* * this code later should be together/refactored with the ‘astra_woo_single_product_structure’ code from snippet named Others PHP ( Mihai ) */ add_action(‘wp’, ‘conditionally_remove_sticky_add_to_cart’); function conditionally_remove_sticky_add_to_cart() { // Check if we are on a single product page if (is_product()) { global…Continue reading