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 | |
// Custom deactivation/activation hooks. | |
$activation_hook = 'plugin_prefix_on_activation'; | |
$deactivation_hook = 'plugin_prefix_on_deactivation'; | |
register_activation_hook( __FILE__, function () use ( $activation_hook ) { | |
add_option( $activation_hook, 'yes' ); | |
} ); | |
register_deactivation_hook( __FILE__, function () use ( $deactivation_hook ) { | |
do_action( $deactivation_hook ); | |
} ); |
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 | |
/** | |
* converts array to string. | |
* | |
* @param $arr | |
* @param array $args | |
* | |
* @return string | |
*/ | |
function convert_array_to_string( $arr, $args = array() ) { |
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_get_shop_coupon_data', 'fix_wc_coupon_discount_amount', 10, 3); | |
function fix_wc_coupon_discount_amount( $false, $data, $coupon ) { | |
if ( | |
'yes' !== get_option( 'wcj_multicurrency_compatibility_wc_coupons', 'no' ) | |
|| is_admin() | |
|| empty( $coupon_id = wc_get_coupon_id_by_code( $data ) ) | |
|| 'fixed_cart' != get_post_meta( $coupon_id, 'discount_type', true ) | |
) { | |
return $false; |
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('wp_footer',function(){ | |
if ( !WCJ()->modules['price_by_country']->is_enabled() ) { | |
return; | |
} | |
$country = WCJ()->modules['price_by_country']->core->get_customer_country_by_ip(); | |
$group = WCJ()->modules['price_by_country']->core->get_customer_country_group_id(); | |
$the_result = array('country'=>$country,'group'=>$group); | |
?> | |
<script> |
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 | |
/** | |
* Deletes transients that match a specific prefix. | |
* | |
* @author Pablo Pacheco <[email protected]> | |
* @param string $prefix prefix to search for. | |
* @return int|bool Boolean true for CREATE, ALTER, TRUNCATE and DROP queries. Number of rows affected/selected for all other queries. Boolean false on error. | |
*/ | |
function delete_transients_by_prefix($prefix){ |
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 | |
// Remove the Tax Line item from the cart. | |
function wc_remove_cart_tax_totals( $tax_totals, $instance ) { | |
if( is_cart() ) { | |
$tax_totals = array(); | |
} | |
return $tax_totals; | |
} |
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
<tr><td><div><label for="%field_id%">%title%</label></div>%field%</td></tr> |
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('wp_loaded',function(){ | |
if( is_admin() ){ | |
return; | |
} | |
$product_id = 161; | |
$quantity = 1; | |
$variation_id = 0; | |
WC()->cart->add_to_cart( $product_id, $quantity, $variation_id, array(), array( | |
'alg_open_price' => 99 |
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 | |
/* | |
Plugin Name: Customize Product Input Field Frontend Position | |
Description: Customizes frontend position of Product Input Field plugin | |
Version: 1.0.0 | |
Author: Algoritmika Ltd | |
Author URI: http://algoritmika.com | |
License: GNU General Public License v3.0 | |
License URI: http://www.gnu.org/licenses/gpl-3.0.html | |
Text Domain: customize-pif-frontend-position |
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 | |
// Remove default input | |
add_filter( 'option_' . 'alg_wc_product_open_pricing_frontend_template', 'popwc_remove_default_input' , 10, 2 ); | |
function popwc_remove_default_input($value){ | |
if(!is_admin()){ | |
$value=''; | |
} | |
return $value; | |
} |
NewerOlder