This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* "Live Visitor Count" feature using Server-Sent Events (SSE) in a WooCommerce | |
* Display a live count of how many users are currently viewing a particular product. | |
*/ | |
add_action('rest_api_init', 'register_api_routes'); | |
function register_api_routes() | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Calculate Shipping Costs Programmatically in WooCommerce | |
* - fetch standard methods | |
* - integrate with Flexible-shipping Plugin | |
*/ | |
function ct_get_available_shipping_methods_for_customer_cart($country_code = 'PL') { | |
if (function_exists('WC')) { |