• I’m trying unsuccessfully to create the most simple (or so I thought) edits within my woocommerce pages and have spent hours looking for resources online only to come up empty. All I’m trying to do is modify the layout of single product pages, and I have to say it is, genuinely, not possible to do this!

    There’s loads of replies to questions like this online, here on wp.org, over on the wcdocs wiki, and dotted around the net, with the same basic suggestion: ‘Use the hooks. It’s easy. Read about them here’. Well I have to say that’s wrong – it ISN’T ‘easy’. In fact its downright impossible. Most of them point to here which a MASSIVE list of hooks, but no info on what any of them actually do. Or how to use them. In fairness there’s a link on that page to here, which describes adding a hook into functions.php.

    There’s no suggestion of what you might actually input in the space labelled //your code, just an instruction of how to insert it. Guys, no offence and all that, but that is NOT a tutorial on how to add hooks.
    Besides, I’m not trying to ADD anything, I only went as far as looking at hooks because I lost the will to live trying to find a template file to edit. Surely all the ‘hooks’ I might need are ALREADY listed, since the single product pages work fine, they just LOOK a mess.

    I’m using Suffusion theme (which is a pretty complicated affair in its own right and I’ve managed to conquer that, so I reckon I’m okay with WP editing) and my product page has a mahoosive picture left aligned, a ‘summary’ block to the right, and a description underneath. All I’ve been trying to do is remove the image entirely, and place the summary block alongside the description. So far I’ve been at it around fourteen HOURS, and I’m no nearer a solution than when I started! Surely this isn’t how its supposed to be!?

    https://www.ads-software.com/extend/plugins/woocommerce/

Viewing 5 replies - 16 through 20 (of 20 total)
  • Wow, thanks for the link, downrodeo! It’s written in a very user-friendly way.

    Interesting post

    I got the rough idea of woocommerce-hooks.php, function.php

    I m currently using wootheme superstore and would like to move
    have the product description (i think that should be div class woo commerce-tabs)
    underneath my image and price add to cart field. I tried to find a solution by looking at the emporium theme by woothemes,

    if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
    ?>
    
    <?php
    	/**
    	 * woocommerce_before_single_product hook
    	 *
    	 * @hooked woocommerce_show_messages - 10
    	 */
    	 do_action( 'woocommerce_before_single_product' );
    ?>
    
    <div itemscope itemtype="https://schema.org/Product" id="product-<?php the_ID(); ?>" <?php post_class(); ?>>
    
    	<?php
    		/**
    		 * woocommerce_show_product_images hook
    		 *
    		 * @hooked woocommerce_show_product_sale_flash - 10
    		 * @hooked woocommerce_show_product_images - 20
    		 */
    		do_action( 'woocommerce_before_single_product_summary' );
    	?>
    
    	<div class="summary entry-summary">
    
    		<?php
    
    			do_action( 'woocommerce_single_product_summary' );
    
            	?>
    
    	</div><!-- .summary -->
    
    	<?php
    		/**
    		 * woocommerce_after_single_product_summary hook
    		 *
    	     * @hooked woocommerce_template_single_meta - 40
    		 * @hooked woocommerce_template_single_sharing - 50
    		 * @hooked woocommerce_output_product_data_tabs - 10
    		 * @hooked woocommerce_output_related_products - 20
    		 */
    		do_action( 'woocommerce_after_single_product_summary' );
    	?>
    
    </div><!-- #product-<?php the_ID(); ?> -->
    
    <?php do_action( 'woocommerce_after_single_product' ); ?>

    [Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]

    trying to understand the way the layout of woocommerce works.

    is this right????

    the content-single-product.php just calls the two basic divs
    then the content is split up in three calls? before-summary / summary / after-summary?
    the number at the end of the hooks define the ranking or position of appearance within a call?

    so its

    div before @hooked 10
    @hooked 20
    @hooked 30
    summary @hooked 10
    @hooked 20
    @hooked 30
    after @hooked 10
    @hooked 20
    @hooked 30

    with the functions.php I can move stuff around between before summary and after and change ranks: e.g.

    /*---Move Product Title*/
    remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 );
    add_action( 'woocommerce_before_single_product_summary',
    'woocommerce_template_single_title', 5 );

    Is all I need to do now find the right way of

    remove_action delete tabs in summary
    add_action add tabs to after_summary?

    and if review shows up first I ll order the number e.g. @hooked 10 for it to be loaded before review?

    add_action add tabs to after_summary?

    add_action(    'woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 1 );

    as you can seee on

    all is missing is a way to remove the woocommerce-tabs box of the summary

    I tried to edit a woocommerce add_action, but it does not work. Dont know whether this is the right way to customize a woocommerce action?

    What I did:

    added following code into woocommerce functions.php

    global $woocommerce;
    $arr=$woocommerce->payment_gateways->get_available_payment_gateways();
    remove_action( 'woocommerce_email_before_order_table', array($arr['bacs'] , 'email_instructions' ), 10, 2 );
    add_action( 'woocommerce_email_before_order_table', array( $arr['bacs'], 'newemail' ), 10, 2 );
    function newemail( $order, $sent_to_admin ) {
    
        	if ( $sent_to_admin ) return;
    
        	if ( $order->status !== 'on-hold') return;
    
        	if ( $order->payment_method !== 'bacs') return;
    
    		if ( $description = $arr['bacs']->get_description() )
            	echo wpautop( wptexturize( $description ) );
    
    		?><h2><?php _e( 'FuckingDetails', 'woocommerce' ) ?></h2><ul class="order_details bacs_details"><?php
    
    		$fields = apply_filters('woocommerce_bacs_fields', array(
    			'account_name' 	=> __( 'Account Name', 'woocommerce' ),
    			'account_number'=> __( 'Account Number', 'woocommerce' ),
    			'sort_code'		=> __( 'Sort Code', 'woocommerce' ),
    			'bank_name'		=> __( 'Bank Name', 'woocommerce' ),
    			'iban'			=> __( 'IBAN', 'woocommerce' ),
    			'bic'			=> __( 'BIC', 'woocommerce' )
    		));
    
    		foreach ($fields as $key=>$value) :
    		    if(!empty($arr['bacs']->$key)) :
    		    	echo '<li class="'.$key.'">'.$value.': <strong>'.wptexturize($arr['bacs']->$key).'</strong>';
    		    endif;
    		endforeach;
    
    		?><?php
        }



    [Please use the code buttons when posting code ]

    Action removes, but then When I add my new customized action it does not trigger. Also it has problems with other payment gateways

    Nearly a year later, and this problem still exists.

    The templating system is still completely absurd. So it needs good documentaton.

    But the documentation offered by woocommerce is still absolute rubbish.

    Once I’ve done my current project, I’m never going near the pile of rubbish that is woocommerce again.

    There is absolutely no reason for their templating system to be so difficult. I’d recommend developers stay away from this dreck.

Viewing 5 replies - 16 through 20 (of 20 total)
  • The topic ‘Most basic customisation seems impossible’ is closed to new replies.