Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1215032
    Flightwave
    Participant

    Hi,
    I have purchased the woocommerce extension “Product AddOns”.
    I realize that this is a woocommerce thing, but since X comes bundled with WooComm, I’m hoping that the X staff will still help me with this:

    Please look at this page: http://www.flightwave.aero.vhost.zerolag.com/product/verteon/

    At the top are product pictures – and product name, followed by product price.
    THEN, are all the add-on options, with prices and the option to select quantity
    THEN, after all the add-ons, is a blank quantity box, with no label. THIS is where the shopper is supposed to select the quantity of the product itself. But it’s confusing, because it comes AFTER all of the addons, and with no label telling the shopper what it is. I eventually figured it out – but this is a design flaw – and shouldn’t look like this.

    I wrote WooCommerce, and they sent me some links telling how to copy over and edit certain php files – but that is above my head. ThemeCo support is SOOOOO much more helpful. Would you guys kindly help me with how to do this?

    The WC response was as follows:
    Yes, you can change the single product page and moving around the elements by changing the single-product-php template. To do this in a safe way, copy the template file from WC plugin to your theme and modify that copy.
    Here is some additional information on how to override templates via a theme:
    https://docs.woocommerce.com/document/template-structure/

    You can also find some tutorials online. I’ve found these two that can be helpful:
    https://www.alphablossom.com/move-woocommerce-price-on-single-product-page/
    http://wpbackoffice.com/reorder-product-page-contents-woocommerce/

    Thanks in advance!

    #1215378
    Rad
    Moderator

    Hi there,

    Thanks for writing.

    Woocommerce isn’t bundled with X theme, but X theme is made compatible with it ( https://community.theme.co/kb/version-compatibility/ ).

    I really love to help but I’m not really familiar with the said add-ons, but if you’re just looking for loop orders, then you can find it here

    \x\framework\functions\global\plugins\woocommerce.php

    Other templates should be under \x\woocommerce\ folder

    You may edit them. X theme uses the implementation of woocommerce_content(); https://docs.woocommerce.com/wc-apidocs/function-woocommerce_content.html. If you wish to add something then you may provide the code and I’ll provide more recommendation 🙂

    Thanks!

    #1215410
    Flightwave
    Participant

    Thanks for the reply.
    Specifically – my question is…
    When they say, “copy the single-products-php template file from WC plugin to your theme and modify that copy” – how do I do that? Where do I find said file. I’m using Cornerstone, and WordPress, so where do I find these woocommerce template files – how do I access them / copy them, etc, and where do I paste them to “add them to my theme”?
    Thanks so much,
    Chris

    #1215744
    Rad
    Moderator

    Hi there,

    You can copy them from /wp-content/plugins/woocommerce/templates/ to /x-child/woocommerce/

    But like I was saying, there are many ways to implement it and X theme uses woocommerce_content() which override the wp-single.php 🙂

    That instruction only applies to a theme that isn’t yet integrated to Woocommerce. X theme has its own integration, hence, you’ll have to edit the existing integration, if you plan to integrate your own templates then you may need to remove or edit X theme’s existing files.

    I could help you on that aspect, just let me know what you wish to add and where.

    Thanks!

    #1216501
    Flightwave
    Participant

    Hi there – thanks again for the response.

    I don’t want to integrate my own templates.
    All I want to do is the following:
    First – here’s the product page: http://www.flightwave.aero.vhost.zerolag.com/product/verteon/

    You’ll notice that there are quantity boxes for everything.
    Problem is – the quantity box for the actual product (Verteon) is at the bottom – after all of the “Add-ons”. At the bottom of the list of Add-Ons is one extra quantity box – by itself – with no label. I’d like to bring that up to the top where the product itself is – and maybe even add a label to it so shoppers know what it’s for.

    How can I do this?

    When you refer to file locations – are you referring to where these files are stored in the root directory on the hosting company’s servers? Or can I access this directory structure somehow from within wordpress or X?

    Thank you for your help.
    Chris

    #1216506
    Flightwave
    Participant

    p.s.
    with regards to adding a label to the Verteon product box – the label could simply be “Verteon” – that way shoppers would know they were selecting the number of Verteon’s they were purchasing.

    #1216512
    Flightwave
    Participant

    If you could walk me through this step by step – I’d appreciate it.
    Thanks,
    Chris

    #1217004
    Rad
    Moderator

    Hi there,

    I just checked and it’s due to woocommerce built-in templates and not related to X theme templates.

    Please copy these files,

    \wp-content\plugins\woocommerce\templates\single-product\add-to-cart\grouped.php
    \wp-content\plugins\woocommerce\templates\single-product\add-to-cart\simple.php

    And paste them to your child theme, like these

    \wp-content\themes\x-child\woocommerce\single-product\add-to-cart\grouped.php
    \wp-content\themes\x-child\woocommerce\single-product\add-to-cart\simple.php

    Then edit your duplicates and move this code

    <?php
    	 		if ( ! $product->is_sold_individually() ) {
    	 			woocommerce_quantity_input( array(
    	 				'min_value'   => apply_filters( 'woocommerce_quantity_input_min', 1, $product ),
    	 				'max_value'   => apply_filters( 'woocommerce_quantity_input_max', $product->backorders_allowed() ? '' : $product->get_stock_quantity(), $product ),
    	 				'input_value' => ( isset( $_POST['quantity'] ) ? wc_stock_amount( $_POST['quantity'] ) : 1 )
    	 			) );
    	 		}
    	 	?>

    Jus above this code,

    <?php do_action( 'woocommerce_before_add_to_cart_button' ); ?>

    They are hard coded to Woocommerce templates.

    Hope this helps.

    #1268778
    Flightwave
    Participant

    Thanks!

    I have copied these two files as instructed – and pasted then where in structed.
    I had to create folders in x-child folder for these files – which I did (please see file structure image).

    I saw the code you referenced in the “simple.php” file and made the changes you instructed.

    However, I could not find that code in the “grouped.php” file. Please see the two “grouped.php” code images (1 & 2), and let me know how I need to edit that file.

    Thanks!
    Chris

    #1269127
    Rad
    Moderator

    Hi there,

    For grouped.php, please move this code

    <?php if ( $product->is_sold_individually() || ! $product->is_purchasable() ) : ?>
    								<?php woocommerce_template_loop_add_to_cart(); ?>
    							<?php else : ?>
    								<?php
    									$quantites_required = true;
    									woocommerce_quantity_input( array(
    										'input_name'  => 'quantity[' . $product_id . ']',
    										'input_value' => ( isset( $_POST['quantity'][$product_id] ) ? wc_stock_amount( $_POST['quantity'][$product_id] ) : 0 ),
    										'min_value'   => apply_filters( 'woocommerce_quantity_input_min', 0, $product ),
    										'max_value'   => apply_filters( 'woocommerce_quantity_input_max', $product->backorders_allowed() ? '' : $product->get_stock_quantity(), $product )
    									) );
    								?>
    							<?php endif; ?>

    Just above this code

    <input type="hidden" name="add-to-cart" value="<?php echo esc_attr( $product->id ); ?>" />
    
    	<?php if ( $quantites_required ) : ?>
    
    		<?php do_action( 'woocommerce_before_add_to_cart_button' ); ?>
    
    		<button type="submit" class="single_add_to_cart_button button alt"><?php echo esc_html( $product->single_add_to_cart_text() ); ?></button>
    
    		<?php do_action( 'woocommerce_after_add_to_cart_button' ); ?>
    
    	<?php endif; ?>

    Cheers!

    #1273549
    Flightwave
    Participant
    This reply has been marked as private.
    #1273554
    Flightwave
    Participant
    This reply has been marked as private.
    #1273707
    Flightwave
    Participant

    Nevermind – i figured it out!

    In case it helps you with others – the solution was that the copied template files (that are edited) need to be put in the following folder:

    wp-content\plugins\woocommerce\templates\single-product\add-to-cart

    instead of

    \wp-content\themes\x-child\woocommerce\single-product\add-to-cart\ (which doesn’t exist unless you create it)

    Thanks!

    #1273823
    Friech
    Moderator

    Glad you sorted things out. The thing with that is when the plugin updates (woocommerce) your custom template will be overwritten.

    Yes, that is correct child theme does not have that directory by default. So you need to create it.

    Thanks.

  • <script> jQuery(function($){ $("#no-reply-1215032 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>