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 | |
function ca_wpt_product_loop( $product_loop, $shortcode ){ | |
foreach($product_loop->posts as $post ){ | |
if( $post->comment_count >= 2 ){ | |
$post->post_title = $post->post_title . " ( Popular Product )"; | |
} | |
} | |
return $product_loop; | |
} | |
add_filter('wpt_product_loop', 'ca_wpt_product_loop', 10, 2); |
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 | |
add_filter( 'wpto_login_url', function(){ | |
return 'www.yoursite.com/my-account'; | |
}); |
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 | |
/** | |
* Author: Hannan | |
* Desc: Change view cart url on woo product table | |
* Date: 26.02.2023 | |
*/ | |
if( !function_exists('codeastrology_change_view_cart_url') ){ | |
function codeastrology_change_view_cart_url($link){ |
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 | |
/** | |
* Author: Hannan | |
* Date: 06.02.2023 | |
* Desc: Turn Off Dokan Template in woo product table | |
* */ | |
if( !function_exists('codeAstrology_turnoff_dokan_template')){ | |
function codeAstrology_turnoff_dokan_template(){ |
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 | |
add_action( 'woocommerce_checkout_update_order_meta', 'codeastrology_save_new_checkout_field' ); | |
function codeastrology_save_new_checkout_field( $order_id ) { | |
if ( $_POST['license_no'] ) update_post_meta( $order_id, '_license_no', esc_attr( $_POST['license_no'] ) ); | |
} | |
add_action( 'woocommerce_admin_order_data_after_billing_address', 'codeastrology_show_new_checkout_field_order', 10, 1 ); | |
function codeastrology_show_new_checkout_field_order( $order ) { |
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 | |
add_action( 'woocommerce_before_order_notes', 'codeastrology_add_custom_checkout_field' ); | |
function codeastrology_add_custom_checkout_field( $checkout ) { | |
$current_user = wp_get_current_user(); | |
$saved_license_no = $current_user->license_no; | |
woocommerce_form_field( 'license_no', array( | |
'type' => 'text', | |
'class' => array( 'form-row-wide' ), | |
'label' => 'License Number', |
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 | |
add_action( 'woocommerce_before_order_notes', 'ca_add_custom_checkout_field' ); | |
function ca_add_custom_checkout_field( $checkout ) { | |
$current_user = wp_get_current_user(); | |
$saved_license_no = $current_user->license_no; | |
woocommerce_form_field( 'license_no', array( | |
'type' => 'text', | |
'class' => array( 'form-row-wide' ), | |
'label' => 'License Number', |
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 | |
/** | |
* Update the order meta with field value | |
*/ | |
add_action( 'woocommerce_checkout_update_order_meta', 'my_custom_checkout_field_update_order_meta' ); | |
function my_custom_checkout_field_update_order_meta( $order_id ) { | |
if ( ! empty( $_POST['my_field_name'] ) ) { | |
update_post_meta( $order_id, 'My Field', sanitize_text_field( $_POST['my_field_name'] ) ); |
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 | |
add_action( 'woocommerce_after_order_notes', 'my_custom_checkout_field' ); | |
function my_custom_checkout_field( $checkout ) { | |
/** | |
* Process the checkout | |
*/ | |
add_action('woocommerce_checkout_process', 'my_custom_checkout_field_process'); |
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 | |
add_action( 'woocommerce_after_order_notes', 'my_custom_checkout_field' ); | |
function my_custom_checkout_field( $checkout ) { | |
echo '<div id="my_custom_checkout_field"><h2>' . __('My Field') . '</h2>'; | |
woocommerce_form_field( 'my_field_name', array( | |
'type' => 'text', | |
'class' => array('my-field-class form-row-wide'), |
NewerOlder