This file contains 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
/** | |
* Add the field to the checkout | |
**/ | |
add_action('woocommerce_after_order_notes', 'my_custom_checkout_field'); | |
function my_custom_checkout_field( $checkout ) { | |
echo '<div id="my_custom_checkout_field"><h3>'.__('My Field').'</h3>'; | |
/** |
This file contains 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
$.ajax({ | |
type: "POST", | |
url: 'https://blissco.sandbox.onample.com/api/v1/users/login', | |
data: 'username=user&password=pass', | |
success: function(data) | |
{ | |
let headers = new Headers(); | |
headers.set('Authorization', 'Basic ' + btoa("key:secret")); | |
headers.set('Content-Type','application/json'); |
This file contains 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 | |
# WooCommerce 2.6 -> 3.0 "Compatibility" Variables | |
$order_id = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->id : $order->get_id(); | |
$order_date = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->order_date : $order->get_date_created(); | |
$billing_first_name = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->billing_first_name : $order->get_billing_first_name(); | |
$billing_last_name = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->billing_last_name : $order->get_billing_last_name(); |
WoCommerce Subscriptions processes automatic renewal payments via the following flow:
- its scheduling system, Action Scheduler, will run every minute and find any
woocommerce_scheduled_subscription_payment
actions scheduled to run now or within the last minute - if there are
woocommerce_scheduled_subscription_payment
actions scheduled for anytime before now, Action Scheduler will grab a batch of those actions and begin processing them (which just means triggeringdo_action( 'scheduled_subscription_payment', $subscription_id )
for any 3rd party code to handle) - Subscriptions attaches two important functions as callbacks on the
'woocommerce_scheduled_subscription_payment'
hook to process renewal for that subscription when it is called: WC_Subscriptions_Manager::prepare_renewal()
, which is responsible for
This file contains 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
/** | |
* Insert an attachment from an URL address. | |
* | |
* @param String $url | |
* @param Int $post_id | |
* @param Array $meta_data | |
* @return Int Attachment ID | |
*/ | |
function crb_insert_attachment_from_url($url, $post_id = null) { |
This file contains 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
add_action( 'woocommerce_before_cart', 'apply_matched_coupons' ); | |
function apply_matched_coupons() { | |
global $woocommerce; | |
$get1 = 'getonech'; // your coupon code here | |
$get2 = 'gettwoch'; // your coupon code here | |
$get3 = 'getthreech'; // your coupon code here | |
$get4 = 'getfourch'; // your coupon code here | |
$get5 = 'getfivech'; // your coupon code here |
This file contains 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
curl --header 'Authorization: token INSERTACCESSTOKENHERE' \ | |
--header 'Accept: application/vnd.github.v3.raw' \ | |
--remote-name \ | |
--location https://api.github.com/repos/owner/repo/contents/path | |
# Example... | |
TOKEN="INSERTACCESSTOKENHERE" | |
OWNER="BBC-News" | |
REPO="responsive-news" |
This file contains 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
curl -H 'Authorization: token INSERTACCESSTOKENHERE' -H 'Accept: application/vnd.github.v3.raw' -O -L https://api.github.com/repos/owner/repo/contents/path |
NewerOlder