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 | |
/** | |
* Run a specific workflow for a specific order. | |
* | |
* @param int $workflow_id | |
* @param int $order_id | |
* | |
* @throws \Exception | |
*/ |
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 | |
/** | |
* AutomateWoo: Make generated coupon descriptions match the template coupon. | |
* | |
* Requires AutomateWoo 5.2. | |
*/ | |
add_action( | |
'automatewoo/coupon_generator/generate_from_template_coupon', | |
function ( $coupon, $template_coupon ) { |
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 | |
/** | |
* Add product images to the WooCommerce order table used in HTML emails. | |
*/ | |
add_filter( 'woocommerce_email_order_items_args', function( $args ) { | |
$args['show_image'] = true; | |
$args['image_size'] = array( 100, 100 ); | |
return $args; | |
}, 10, 1 ); |
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 | |
defined( 'ABSPATH' ) || exit; | |
/** | |
* Custom Rule: Order - Delivery Date | |
* | |
* This is an example of creating a custom date rule that uses a meta field as the date value. | |
* By extending the AutomateWoo\Rules\Abstract_Date class we can use the existing date comparison types with this custom rule. | |
* For more about date-based rules see: https://automatewoo.com/docs/rules/date-based-rules/ |
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 | |
/** | |
* AutomateWoo action function to extend a subscription by 3 months. | |
* | |
* A note will be added to the subscription. | |
* | |
* Ensures that the dates near the end of the month are logically handled and do not shift to the start of the following month. | |
* | |
* Custom action function docs: https://automatewoo.com/docs/actions/custom-functions/ | |
* |
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 | |
if ( ! defined( 'ABSPATH' ) ) { | |
exit; | |
} | |
// Register AutomateWoo triggers. | |
add_filter( 'automatewoo/triggers', function ( $triggers ) { | |
// Include the file containing the trigger class | |
require_once 'my-custom-order-paid-trigger.php'; |
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 | |
add_filter( 'woocommerce_rest_prepare_shop_order_object', 'my_automatewoo_referrals_add_advocate_coupon_to_order_api', 10, 3 ); | |
/** | |
* AutomateWoo Refer A Friend - Add customer's referral coupon to order objects returned from REST API | |
* | |
* Because guest customers can't be advocates only orders by registered users will have the code added. | |
* |
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 | |
add_action( 'woocommerce_checkout_order_processed', 'my_woocommerce_copy_billing_email_to_user_profile', 10, 3 ); | |
/** | |
* Copy the order billing address to user profile when profile email is blank. | |
* | |
* Requires WooCommerce 3.0 | |
* | |
* @param $order_id |
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 | |
add_filter( 'automatewoo/referrals/coupon_data', 'my_automatewoo_referrals_free_gift_coupon_data', 10, 4 ); | |
/** | |
* Make AutomateWoo Refer A Friend coupons free gift coupons. | |
* | |
* REQUIRES: WooCommerce v3.6 and Refer A Friend v2.3.1 | |
* REQUIRES: https://woocommerce.com/products/free-gift-coupons/ | |
* |
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 | |
$user_id = 1; | |
$advocate = \AutomateWoo\Referrals\Advocate_Factory::get( $user_id ); | |
// Retrieve or generate a shareable referral coupon (coupon sharing only) | |
$advocate->get_shareable_coupon(); | |
// Retrieve or generate a shareable referral link (link sharing only) | |
$advocate->get_shareable_link(); |
NewerOlder