Last active
November 29, 2018 17:17
-
-
Save jrick1229/9911d03ecba9a923c1ddffc196f19517 to your computer and use it in GitHub Desktop.
renewal_choice_type_cart
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 renewal_choice_type_cart() { | |
?> | |
<div class="renewal-cart-choice-field"> | |
<label for="renewal-cart-choice">Renewal method:</label> | |
<select id="renewal-cart-choice" name="renewal-cart-choice"> | |
<option value="auto">Automatic Renewal</option> | |
<option value="manual">Manual Renewal</option> | |
</select> | |
</div> | |
<?php | |
if ($_POST['renewal-cart-choice'] === 'auto') { | |
$subscription->set_requires_manual_renewal( false ); | |
} | |
elseif ( $_POST['renewal-cart-choice'] === 'manual' ) { | |
$subscription->set_requires_manual_renewal( true ); | |
} | |
} | |
add_action( 'woocommerce_cart_contents', 'renewal_choice_type_cart', 10 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment