Forum Replies Created

Viewing 12 replies - 1 through 12 (of 12 total)
  • Thread Starter pas2019

    (@pas2019)

    PS. custom ordering works well, i have set this up for now and placed all the attributes in the right order.

    Name (numeric) still isnt working, also not after updating woocommerce

    Thread Starter pas2019

    (@pas2019)

    Hi,

    Thats correct, i tried every step you told but even when i disable all the plugins including elementor and used the storefront theme the sorting is not working.

    I can provide system report but i prefer to not paste it here, is there another way to share it?

    Regards

    Thread Starter pas2019

    (@pas2019)

    or in here maybe…combined with the code above

    $html = '<form action="' . esc_url( $product->add_to_cart_url() ) . '" class="cart" method="post" enctype="multipart/form-data">';
    		$html .= woocommerce_quantity_input( array(), $product, false );
    		$html .= '<button type="submit" class="button alt">' . esc_html( $product->add_to_cart_text() ) . '</button>';
    		$html .= '</form>';
    		return $html;
    Thread Starter pas2019

    (@pas2019)

    hmm when replacing this with the code beneath it shows multiple variations without selectable options (there is only show options available in the drop down)

    <?php foreach ( $product->get_attributes() as $attribute_name => $options ) : ?>

    The option size is also available in the variables but in here i cant choose any.

    when replacing the code with the original:

    <?php foreach ( $product->get_variation_attributes() as $attribute_name => $options ) : ?>

    It shows me only 1 (the right) variation (size) with the corresponding selectable options but i cant add them to cart.

    seems to be in here somewhere but i cant figure out where

    Thread Starter pas2019

    (@pas2019)

    it think it must be in this rule but i cant find out what it is:

    <?php foreach ( $product->get_variation_attributes() as $attribute_name => $options ) : ?>

    Thread Starter pas2019

    (@pas2019)

    When i remove the code like below i see the option: Select options below each product with variables, for the regular single products the same button is: In cart

    When i click on the button select options it will take me to the product page where everything is working fine (it also did before)

    The issue is really in this code

    // Display variations dropdowns on shop page for variable products
     add_filter( 'woocommerce_loop_add_to_cart_link', 'woo_display_variation_dropdown_on_shop_page' );
    
     function woo_display_variation_dropdown_on_shop_page() {
    
     	global $product;
    
    	if( $product->is_type( 'variable' )) {
    
    	$attribute_keys = array_keys( $product->get_attributes() );
    	?>
    
    	<form class="variations_form cart" method="post" enctype='multipart/form-data' data-product_id="<?php echo absint( $product->id ); ?>" data-product_variations="<?php echo htmlspecialchars( json_encode( $product->get_available_variations() ) ) ?>">
    		<?php do_action( 'woocommerce_before_variations_form' ); ?>
    
    		<?php if ( empty( $product->get_available_variations() ) && false !== $product->get_available_variations() ) : ?>
    			<p class="stock out-of-stock"><?php _e( 'This product is currently out of stock and unavailable.', 'woocommerce' ); ?></p>
    		<?php else : ?>
    			<table class="variations" cellspacing="0">
    				<tbody>
    					<?php foreach ( $product->get_variation_attributes() as $attribute_name => $options ) : ?>
    						<tr>
    							<td class="label"><label for="<?php echo sanitize_title( $attribute_name ); ?>"><?php echo wc_attribute_label( $attribute_name ); ?></label></td>
    							<td class="value">
    								<?php
    									$selected = isset( $_REQUEST[ 'attribute_' . sanitize_title( $attribute_name ) ] ) ? wc_clean( urldecode( $_REQUEST[ 'attribute_' . sanitize_title( $attribute_name ) ] ) ) : $product->get_variation_default_attribute( $attribute_name );
    									wc_dropdown_variation_attribute_options( array( 'options' => $options, 'attribute' => $attribute_name, 'product' => $product, 'selected' => $selected ) );
    									echo end( $attribute_keys ) === $attribute_name ? apply_filters( 'woocommerce_reset_variations_link', '<a class="reset_variations" href="#">' . __( 'Clear', 'woocommerce' ) . '</a>' ) : '';
    								?>
    							</td>
    						</tr>
    					<?php endforeach;?>
    				</tbody>
    			</table>
    
    			<?php do_action( 'woocommerce_before_add_to_cart_button' ); ?>
    
    			<div class="single_variation_wrap">
    				<?php
    					/**
    					 * woocommerce_before_single_variation Hook.
    					 */
    					do_action( 'woocommerce_before_single_variation' );
    
    					/**
    					 * woocommerce_single_variation hook. Used to output the cart button and placeholder for variation data.
    					 * @since 2.4.0
    					 * @hooked woocommerce_single_variation - 10 Empty div for variation data.
    					 * @hooked woocommerce_single_variation_add_to_cart_button - 20 Qty and cart button.
    					 */
    					do_action( 'woocommerce_single_variation' );
    
    					/**
    					 * woocommerce_after_single_variation Hook.
    					 */
    					do_action( 'woocommerce_after_single_variation' );
    				?>
    			</div>
    
    			<?php do_action( 'woocommerce_after_add_to_cart_button' ); ?>
    		<?php endif; ?>
    
    		<?php do_action( 'woocommerce_after_variations_form' ); ?>
    	</form>
    
    	<?php } else {
    
    		$html = '<form action="' . esc_url( $product->add_to_cart_url() ) . '" class="cart" method="post" enctype="multipart/form-data">';
    		$html .= woocommerce_quantity_input( array(), $product, false );
    		$html .= '<button type="submit" class="button alt">' . esc_html( $product->add_to_cart_text() ) . '</button>';
    		$html .= '</form>';
    		return $html;
    
    	}
    
    }
    

    same issue here

    Thread Starter pas2019

    (@pas2019)

    please help me out

    Thread Starter pas2019

    (@pas2019)

    Anyone?

    Thread Starter pas2019

    (@pas2019)

    the menu item is set but it’s only displaying languages as text in dutch, no flags.

    • This reply was modified 5 years, 5 months ago by pas2019.
    Thread Starter pas2019

    (@pas2019)

    Yes, I see the flags in the wp admin bar and also in wp-admin -> pages -> NL and ENG but I can’t set it in the menu bar?

    Thread Starter pas2019

    (@pas2019)

    Hi Anticosti, thanks for your help.

    Unfortunatly, I added a code snippet with the php code above and added the menu item languages but still no flag… The shortcode is displayed as shortcode in the page, this is also not working.

    Any other idea?

Viewing 12 replies - 1 through 12 (of 12 total)