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
/** | |
* Customize Link on Addresses Page | |
* @param string $html The current link html. | |
* @param string $link The link to update the scheduled orders. | |
* @return string The updated html for the link. | |
*/ | |
function xx_customize_update_my_autoship_scheduled_orders_link( $html, $link ){ | |
return sprintf( __('<p style="padding:10px;border:1px solid #eee;border-radius:5px">Click <a href="%s">here</a> to update you shipping address on all Scheduled Orders</p>', 'autoship'), $link ); | |
} | |
add_filter( 'autoship_display_apply_customer_info_to_all_scheduled_orders_btn_link_label', 'xx_customize_update_my_autoship_scheduled_orders_link', 10, 2); |
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
/** | |
* Custom Added by Autoship Cloud Custom Development | |
* Filter for only Valid Autoship Payment Gateways | |
* @param array $gateways The array of available payment gateways. | |
* @return array The filtered $gateways | |
*/ | |
function xx_filter_autoship_gateways( $gateways ){ | |
// if Autoship is not installed return all gateways. |
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
/** | |
* Adjust the duration between health checks | |
* NOTE Health checks only occur when logged in as an admin and only when looking at the admin menu. | |
* | |
* @param int $duration The delay between health checks | |
* @return int The filtered duration | |
*/ | |
function xx_filter_autoship_healthcheck_duration( $duration ){ | |
return 240; |
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
/** | |
* The following three hooks remove the session actions used in the autoship native ui. | |
* Note when not using the Session variable the Native UI option should not be used for Schedule Orders. | |
*/ | |
function xx_remove_autoship_session_init_hooks(){ | |
remove_action( 'init', 'autoship_start_session', 1); | |
} | |
add_action( 'init', 'xx_remove_autoship_session_init_hooks', 0 ); | |
function xx_remove_autoship_session_logout_hooks(){ |
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
/** | |
* Dequeue the Chatbot script. | |
* | |
* Hooked to the wp_print_scripts action, with a late priority (100), | |
* so that it is after the script was enqueued. | |
*/ | |
function xx_dequeue_script() { | |
wp_dequeue_script( 'autoship-webchat' ); | |
} | |
add_action( 'wp_print_scripts', 'xx_dequeue_script', 100 ); |
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
/** | |
* Filter the Autoship Label | |
* | |
* @param string $autoship_select Yes or No for autoship or not. | |
* @param bool $discount True if there is a discount else false. | |
* @param WC_Product $product The wc product object. | |
* @return string The filtered label. | |
*/ | |
function xx_adjust_autoship_label( $label, $autoship_select, $discount, $product ){ |
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
/** | |
* Adjusts the Security for the Autoship Sub Pages | |
* @link https://codex.wordpress.org/Roles_and_Capabilities#Capability_vs._Role_Table | |
* | |
* @param string $capability The current required cap. | |
* @param string $menu_slug The Sub Menu Page. | |
* @return string $capability The filtered cap. | |
*/ | |
function xx_adjust_autoship_cloud_subpage_security( $capability, $menu_slug ){ |
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
/** | |
* Change Product Page and Cart Autoship labels | |
* | |
* @param string $label The current option label. | |
* @param string $option_type if this is the autoship radio or 'no' if this is the one time purchase | |
* @param bool $savings if there is a savings associated with autoship else false. | |
* @param WC_Product $product The current product object. | |
* | |
* @return string the filtered label | |
*/ |
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
/** | |
* Updates the Shipping Address on all scheduled orders for the supplied user | |
* using the Address currintly in My Account > Addresses > Shipping Address | |
* | |
* @param $wc_user_id The WC Customer ID. | |
*/ | |
function xx_update_all_scheduled_orders_with_current_shipping( $wc_user_id ){ | |
// Using the Built in Autoship Function which | |
// a) Connects to QPilot API |
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
/** | |
* Updates the Schedule metadata label | |
* Ex. Schedule: Every 1 Months => Re-Order Schedule: Every 1 Months | |
* @param string $label the current label. | |
* @return string $label The filtered label. | |
*/ | |
function xx_update_all_schedule_labels( $label ){ | |
return 'Re-Order Schedule'; |