This snippet was fetched automatically from WPDistro.cz projects.
<?php
add_action( 'woocommerce_review_order_before_submit', 'bbloomer_add_checkout_per_product_terms', 9 );
function bbloomer_add_checkout_per_product_terms() {
$product_id_1 = 10686;
$product_cart_id_1 = WC()->cart->generate_cart_id( $product_id_1 );
$in_cart_1 = WC()->cart->find_product_in_cart( $product_cart_id_1 );
if ( $in_cart_1 ) {
?>
<div class="woocommerce-terms-and-conditions-wrapper">
<label class="woocommerce-form__label woocommerce-form__label-for-checkbox checkbox">
<input type="checkbox" class="woocommerce-form__label woocommerce-form__label-for-checkbox checkbox" name="terms-1" <?php checked( apply_filters( 'woocommerce_terms_is_checked_default', isset( $_POST['terms-1'] ) ), true ); ?> id="terms"> <span>Souhlasím s podmínkami opakovaných plateb</span> <span class="required">*</span>
</label>
<input type="hidden" name="terms-1-field" value="true">
</div>
<?php
}
// Show Terms 2
$product_id_2 = 2152;
$product_cart_id_2 = WC()->cart->generate_cart_id( $product_id_2 );
$in_cart_2 = WC()->cart->find_product_in_cart( $product_cart_id_2 );
if ( $in_cart_2 ) {
?>
<p class="form-row terms wc-terms-and-conditions">
<label class="woocommerce-form__label woocommerce-form__label-for-checkbox checkbox">
<input type="checkbox" class="woocommerce-form__input woocommerce-form__input-checkbox input-checkbox" name="terms-2" <?php checked( apply_filters( 'woocommerce_terms_is_checked_default', isset( $_POST['terms-2'] ) ), true ); ?> id="terms-2"> <span>I agree to <a href="____" target="_blank">terms-2</a></span> <span class="required">*</span>
</label>
<input type="hidden" name="terms-2-field" value="true">
</p>
<?php
}
}
// Show notice if customer does not tick either terms
add_action( 'woocommerce_checkout_process', 'bbloomer_not_approved_terms_1' );
add_action( 'woocommerce_checkout_process', 'bbloomer_not_approved_terms_2' );
function bbloomer_not_approved_terms_1() {
if ( $_POST['terms-1-field'] == true ) {
if ( empty( $_POST['terms-1'] ) ) {
wc_add_notice( __( 'Je třeba souhlasit s podmínkami opakovaných plateb!' ), 'error' );
}
}
}
function bbloomer_not_approved_terms_2() {
if ( $_POST['terms-2-field'] == true ) {
if ( empty( $_POST['terms-2'] ) ) {
wc_add_notice( __( 'Please agree to terms-2' ), 'error' );
}
}
}
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 |