This snippet was fetched automatically from WPDistro.cz projects.
<?php
add_shortcode('upsell_peeler', function () {
$product_id = apply_filters( 'wpml_object_id', 2862, 'product' );
$product_cart_id = WC()->cart->generate_cart_id( $product_id );
$in_cart = WC()->cart->find_product_in_cart( $product_cart_id );
if ( $in_cart ) {
if (is_cart()) {
add_action( 'wp_footer', 'trigger_myscript', 10, 5);
}
add_filter( 'woocommerce_get_price_html', 'bbloomer_alter_price_display', 9999, 2 );
echo '<div class="upsell-popup">';
echo '<h3 style="text-align:center; font-size: 40px; font-weight: bold;">' . sprintf( esc_html__( '%s discount', 'woocommerce' ), '50%', '' ) . '</h3>';
echo do_shortcode('');
echo '</div>';
} else {
?>
<style>
#cart-sale {
display: none;
}
#cart-sale-long {
width: 100%;
}
</style>
<?php
return;
}
});
function trigger_myscript() {
?>
<script type="text/javascript">
jQuery( window ).on( 'load', function() {
elementorProFrontend.modules.popup.showPopup( { id: 23734 } );
});
</script>
<?php
}
function bbloomer_alter_price_display( $price_html, $product ) {
if ( is_admin() ) return $price_html;
if ( '' === $product->get_price() ) return $price_html;
if ( apply_filters( 'wpml_object_id', $product->get_id(), 'product' ) == apply_filters( 'wpml_object_id', 3621, 'product' ) ) {
$orig_price = $product->get_regular_price();
//$orig_price = wc_get_price_to_display( $product );
echo '<del style="font-size: 18px;">' . $orig_price . " " . get_woocommerce_currency_symbol() . '</del>';
$price_html = wc_price( $orig_price * 0.50 );
//$price_html = wc_price( $orig_price );
}
return $price_html;
}
add_action( 'woocommerce_before_calculate_totals', 'bbloomer_alter_price_cart', 9999 );
function bbloomer_alter_price_cart( $cart ) {
if ( is_admin() && ! defined( 'DOING_AJAX' ) ) return;
$product_id = apply_filters( 'wpml_object_id', 2862, 'product' );
$product_cart_id = WC()->cart->generate_cart_id( $product_id );
$in_cart = WC()->cart->find_product_in_cart( $product_cart_id );
if ( did_action( 'woocommerce_before_calculate_totals' ) >= 2 ) return;
if ( $in_cart ) {
foreach ( $cart->get_cart() as $cart_item_key => $cart_item ) {
if ( apply_filters( 'wpml_object_id', $cart_item['product_id'], 'product' ) == apply_filters( 'wpml_object_id', 3621, 'product' ) ) {
$product = $cart_item['data'];
$price = $product->get_regular_price();
$cart_item['data']->set_price( $price * 0.50 );
//$cart_item['data']->set_price( $price );
}
}
}
}
This snippet was fetched automatically from WPDistro.cz projects.
Cookie | Duration | Description |
---|---|---|
__stripe_mid | 1 year | Stripe sets this cookie cookie to process payments. |
__stripe_sid | 30 minutes | Stripe sets this cookie cookie to process payments. |
cookielawinfo-checkbox-advertisement | 1 year | Set by the GDPR Cookie Consent plugin, this cookie is used to record the user consent for the cookies in the "Advertisement" category . |
cookielawinfo-checkbox-analytics | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics". |
cookielawinfo-checkbox-functional | 11 months | The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional". |
cookielawinfo-checkbox-necessary | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary". |
cookielawinfo-checkbox-others | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other. |
cookielawinfo-checkbox-performance | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance". |
elementor | never | This cookie is used by the website's WordPress theme. It allows the website owner to implement or change the website's content in real-time. |
viewed_cookie_policy | 11 months | The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data. |
Cookie | Duration | Description |
---|---|---|
_gh_sess | session | GitHub sets this cookie for temporary application and framework state between pages like what step the user is on in a multiple step form. |
Cookie | Duration | Description |
---|---|---|
_octo | 1 year | No description available. |
logged_in | 1 year | No description available. |
m | 2 years | No description available. |
TDPrJV | 1 day | No description |
wNiYbt | 1 day | No description |