Change radio button into normal button - Woocommerce - wordpress

I was wondering if there is any chance to change the radio button into a normal button like the one that says "Ask Question" on the Stack Overflow main page.
I'm using woocommerce with deposit - partial payment plugin. The plugin has 2 options, some kind of bar with DEPOSIT and FULL PAYMENT option and the second with radio buttons for the same options.
<?php _e( $deposit_option_text, 'woocommerce-deposits' ); ?>
<span id='deposit-amount'><?php echo $deposit_amount; ?></span>
<span id='deposit-suffix'><?php echo $suffix; ?></span><br><br>
</label>
<div class="<?php echo $basic_buttons ? 'basic-switch-woocommerce-deposits' : 'deposit-options switch-toggle switch-candy switch-woocommerce-deposits'; ?>">
<input id='pay-deposit' name='<?php echo $product->get_id(); ?>-deposit-radio'
type='radio' <?php checked($default_checked ,'deposit'); ?> class='input-radio' value='deposit'>
<label id="pay-deposit-label" for='pay-deposit'
onclick=''><?php _e( $deposit_text , 'woocommerce-deposits' ); ?></label>
<?php if( isset( $force_deposit ) && $force_deposit === 'yes' ){ ?>
<input id='pay-full-amount' name='<?php echo $product->get_id(); ?>-deposit-radio' type='radio'
class='input-radio'
disabled>
<label id="pay-full-amount-label" for='pay-full-amount'
onclick=''><?php _e( $full_text , 'woocommerce-deposits' ); ?></label>
<?php } else{ ?>
<input id='pay-full-amount' name='<?php echo $product->get_id(); ?>-deposit-radio'
type='radio' <?php checked($default_checked ,'full'); ?> class='input-radio' value='full'>
<label id="pay-full-amount-label" for='pay-full-amount'
onclick=''><?php _e( $full_text , 'woocommerce-deposits' ); ?></label>
<?php } ?>
Any idea how to change the 2 radio buttons into regular buttons?

Related

Add a link for a button

Hello i need to add a link in the following code to redirect the (submit button)
Here the code
<form class="checkout adq-billing" enctype="multipart/form-data" action="<?php echo StaticAdqQuoteRequest::get_quote_list_link() ?>" method="post" name="checkout">
<div class="col2-set">
<?php
//Billing/Account information
//, 'is_billing_filled' => $is_billing_filled
adq_get_template( 'adq-form-billing-details.php', array( 'checkout' => StaticAdqQuoteRequest::get_checkout() ) );
?>
<div class="col-2">
<?php
//Force enabled to avoid core Woocommerce system
$shipping->enabled = StaticAdqQuoteRequest::is_shipping_enabled();
//Get Shipping options and address
$shipping->calculate_shipping( WC_Adq()->quote->get_shipping_packages() );
$packages = $shipping->get_packages();
if ( $shipping->enabled ) :
if ( get_option( 'adq_enable_shipping' ) == "user" ) : ?>
<label for="include-shipping-cost">
<?php _e( 'Would you want to include the shipping cost in quotation?', 'woocommerce-quotation' ); ?> <input id="include-shipping-cost" type="checkbox" name="include-shipping-cost" value="1" checked />
</label>
<?php endif;
if ( get_option( 'woocommerce_ship_to_destination' ) != "billing_only" ) :
adq_get_template( 'adq-form-shipping.php', array( 'checkout' => WC()->checkout() ) );
endif;
echo '<div class="adq-shipping">';
foreach ( $packages as $i => $package ) {
$chosen_method = isset( WC()->session->chosen_shipping_methods[ $i ] ) ? WC()->session->chosen_shipping_methods[ $i ] : '';
adq_get_template( 'adq-cart-shipping.php', array( 'package' => $package, 'available_methods' => $package['rates'], 'show_package_details' => ( sizeof( $packages ) > 1 ), 'index' => $i, 'chosen_method' => $chosen_method ) );
};
echo '</div>';
endif;
?>
<p id="quote_comments_field" class="form-row notes woocommerce-validated">
<label class="" for="order_comments"><?php echo __('Message','woocommerce-quotation') ?></label>
<textarea cols="5" rows="2" placeholder="<?php echo __('Please Any other requirements.','woocommerce-quotation') ?>" id="order_comments" class="input-text" name="order_comments" required></textarea>
</p>
</div>
</div>
<?php if ( wc_get_page_id( 'terms' ) > 0 && apply_filters( 'adq_checkout_show_terms', true ) ) : ?>
<p class="form-row terms">
<label for="terms" class="checkbox"><?php printf( __( 'I’ve read and accept the terms & conditions', 'woocommerce-quotation' ), esc_url( get_permalink( wc_get_page_id( 'terms' ) ) ) ); ?></label>
<input type="checkbox" class="input-checkbox" name="terms" <?php checked( apply_filters( 'woocommerce_terms_is_checked_default', isset( $_POST['terms'] ) ), true ); ?> id="terms" />
</p>
<?php endif; ?>
<input type="submit" data-value="<?php echo __('Submit Quote Request','woocommerce-quotation') ?>" value="<?php echo __('Submit','woocommerce-quotation') ?>" id="quote_place_order" name="adq_quote_place_order" class="button alt">
<a class="button wc-backward return-to-shop" href="http://localhost/test"><?php _e( 'Go Back', 'woocommerce-quotation' ) ?></a>
<input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce('woocommerce-process_checkout'); ?>">
</form>
#############################################################
I have added a link and it works but the form was not submitted, is there's any way to submit a form with url redirection, view code
The tag <input type="submit" /> is used to submit a form.
You will find that this INPUT is inside a <form action=""> tag. action="" is the path the form will be submit to.
If you don't need to submit the form, simply use a tag <a></a>.
<a href="#your-link.php" id="quote_place_order" name="adq_quote_place_order" class="button alt">
<?php echo __('Submit','woocommerce-quotation') ?>
</a>
You need a Form tag so you could add an action attribute to that. Now by clicking the submit button your form will be redirected to the URL that u assigned to the form.
<form action="site.com">
<input type="submit">
</form>

Filter By Size not showing all products under the filter in WooCommerce

The site I am facing an issue with is https://919kicks.com/product-category/sneakers/adidas/.
Here, if you try to filter by size on the left side and select one, then it works fine. But then if I select another filter (you'll notice the number of filters reduces and even vanishes) also the number of products remains the same as previous filter.
I thought initially its due to price filter min and max value, so I did a modification like:
<form method="get" action="<?php echo esc_url( $form_action ); ?>">
<div class="price_slider_wrapper">
<div class="price_slider" style="display:none;"></div>
<div class="price_slider_amount" data-step="<?php echo esc_attr( $step ); ?>">
<input type="text" id="min_price" name="min_price" value="0" data-min="0" placeholder="<?php echo esc_attr__( 'Min price', 'woocommerce' ); ?>" />
<input type="text" id="max_price" name="max_price" value="50000" data-max="50000" placeholder="<?php echo esc_attr__( 'Max price', 'woocommerce' ); ?>" />
<?php /* translators: Filter: verb "to filter" */ ?>
<button type="submit" class="button"><?php echo esc_html__( 'Filter', 'woocommerce' ); ?></button>
<div class="price_label" style="display:none;">
<?php echo esc_html__( 'Price:', 'woocommerce' ); ?> <span class="from"></span> — <span class="to"></span>
</div>
<?php echo wc_query_string_form_fields( null, array( 'min_price', 'max_price', 'paged' ), '', true ); ?>
<div class="clear"></div>
</div>
</div>
</form>
If you notice in the form, I've changed the min_price value to 0 and the max_price value to 50000, but it does not work.
Thank you in advance!

Payment Method Selected on Woocommerce Cart page should be active on Checkout Page

I had added three buttons to the cart page, one for each payment method. Clicking on one of the buttons led to the checkout page where the corresponding payment method used to be pre-selected. It used to work, but somehow has stopped working after updating to the latest Woocommerce version. Any other way of doing this?
Here is the code in cart.php template for the buttons:
<form action="<?php echo esc_url( WC()->cart->get_cart_url() ); ?>" method="post">
<input type="submit" class="checkout-button button alt wc-forward" name="proceed" value="<?php _e( 'Order with Purchase Order', 'woocommerce' ); ?>" />
<input type="submit" class="checkout-button button alt wc-forward" name="proceed" value="<?php _e( 'Order with PayPal', 'woocommerce' ); ?>" />
<input type="submit" class="checkout-button button alt wc-forward" name="proceed" value="<?php _e( 'Order with Credit Card', 'woocommerce' ); ?>" />
<?php /*do_action( 'woocommerce_proceed_to_checkout' );*/ ?>
<?php wp_nonce_field( 'woocommerce-cart' ); ?>
</form>

I want to remove the cropping stage of profile image buddypress

I want to remove the cropping stage when I try to upload the avtar/profile image of user, can anyone suggest some solution, I just want a simple image upload function for profile pic. I'm using wp 4.5.3 and buddypress 2.5.3
my theme change avatar code is below
<h4><?php _e( 'Change Profile Photo', 'buddypress' ); ?></h4>
<?php do_action( 'bp_before_profile_avatar_upload_content' ); ?>
<?php if ( !(int)bp_get_option( 'bp-disable-avatar-uploads' ) ) : ?>
<p><?php _e( 'Your profile photo will be used on your profile and throughout the site. If there is a Gravatar associated with your account email we will use that, or you can upload an image from your computer.', 'buddypress' ); ?></p>
<form action="#item-nav" method="post" id="avatar-upload-form" class="standard-form" enctype="multipart/form-data">
<?php if ( 'upload-image' == bp_get_avatar_admin_step() ) : ?>
<?php wp_nonce_field( 'bp_avatar_upload' ); ?>
<p><?php _e( 'Click below to select a JPG, GIF or PNG format photo from your computer and then click \'Upload Image\' to proceed.', 'buddypress' ); ?></p>
<p id="avatar-upload">
<input type="file" name="file" id="file" />
<input type="submit" name="upload" class="button tiny radius" id="upload" value="<?php _e( 'Upload Image', 'buddypress' ); ?>" />
<input type="hidden" name="action" id="action" value="bp_avatar_upload" />
</p>
<?php if ( bp_get_user_has_avatar() ) : ?>
<p><?php _e( "If you'd like to delete your current profile photo but not upload a new one, please use the delete profile photo button.", 'buddypress' ); ?></p>
<p><a class="button edit" href="<?php bp_avatar_delete_link(); ?>" title="<?php esc_attr_e( 'Delete Profile Photo', 'buddypress' ); ?>"><?php _e( 'Delete My Profile Photo', 'buddypress' ); ?></a></p>
<?php endif; ?>
<?php endif; ?>
<?php if ( 'crop-image' == bp_get_avatar_admin_step() ) : ?>
<h5><?php _e( 'Crop Your New Avatar', 'buddypress' ); ?></h5>
<img src="<?php bp_avatar_to_crop(); ?>" id="avatar-to-crop" class="avatar" alt="<?php _e( 'Avatar to crop', 'buddypress' ); ?>" />
<div id="avatar-crop-pane">
<img src="<?php bp_avatar_to_crop(); ?>" id="avatar-crop-preview" class="avatar" alt="<?php _e( 'Avatar preview', 'buddypress' ); ?>" />
</div>
<input type="submit" class="button small radius" name="avatar-crop-submit" id="avatar-crop-submit" value="<?php _e( 'Crop Image', 'buddypress' ); ?>" />
<input type="hidden" name="image_src" id="image_src" value="<?php bp_avatar_to_crop_src(); ?>" />
<input type="hidden" id="x" name="x" />
<input type="hidden" id="y" name="y" />
<input type="hidden" id="w" name="w" />
<input type="hidden" id="h" name="h" />
<?php wp_nonce_field( 'bp_avatar_cropstore' ); ?>
<?php endif; ?>
</form>
<?php else : ?>
<p><?php _e( 'Your profile photo will be used on your profile and throughout the site. To change your profile photo, please create an account with Gravatar using the same email address as you used to register with this site.', 'buddypress' ); ?></p>
<?php endif; ?>
<?php do_action( 'bp_after_profile_avatar_upload_content' ); ?>
I did not try this
remove_action( 'wp_head', 'bp_core_add_cropper_inline_js' );
Check this article

WordPress WooCommerce: give another button 'add to cart' function

I'd like to give another html element the function of 'add to cart'. Is this possible? I have added some html code into single-product.php and want one of these elements to function as 'add to cart' when you click on them :)
I hope that I've been able to explain myself :P
The following will work as an add to cart button within a product loop, where $product is the post object -
<?php if( $product->is_purchasable() ):?>
<form class="cart" method="post" enctype='multipart/form-data'>
<?php do_action( 'woocommerce_before_add_to_cart_button' ); ?>
<input type="hidden" name="add-to-cart" value="<?php echo esc_attr( $product->id ); ?>" />
<button type="submit">Add to Cart</button>
<?php do_action( 'woocommerce_after_add_to_cart_button' ); ?>
</form>
<?php endif; ?>

Resources