Changes to "class-gust-woocommerce.php"

I need to make changes to this file: class-gust-woocommerce.php but even though I’ve created a child theme for it my modified file is still getting by passed. What is the best way to modify this file other than directly of course.

You can’t overwrite those files by just including them in your child theme. You should be able to overwrite template-parts that way, but in this case it’s probably not relevant. Everything that Gust adds to WooCommerce is done via hooks and filters, so instead of overwriting that file, just add your own hooks and remove the ones added by Gust. I’ve just released a new version of gust which makes this process much easier. Download it and you can do the following:

// here, $gust is a reference to the Gust class instance
function init_gust_child( $gust ) {
  // remove one of our WC actions
  // in this example, we remove the title
  remove_action( 'woocommerce_before_single_product', array( $gust->wc, 'product_page_title' ) );

  // now we're free to add our own
  add_action( 'woocommerce_before_single_product', 'my_child_theme_function' );
}
add_action( 'gust_init', 'init_gust_child' );

Yeah that will make it easier. I ended up doing this for the bit I needed:

function remove_woo_product_header()
{
  $filters = $GLOBALS['wp_filter']['woocommerce_before_single_product'];
  if (empty($filters)) {
    return;
  }

  foreach ($filters->callbacks as $priority => $filter) {
    foreach ($filter as $identifier => $function) {
      if (is_array($function) && is_a($function['function'][0], 'Gust_WooCommerce')) {
        remove_action('woocommerce_before_single_product', array($function['function'][0], 'product_page_title'), $priority);
      }
    }
  }
}

I’m excited to see the new version though. Are there any other items of note in this update?

Ah clever! Well hopefully the new update will simplify that significantly! You should hopefully have access to it by now. If the automatic updates haven’t come through on your install yet ( sometimes this can take a few hours because of WP Transients etc ) you can download it from your dashboard.

Nothing else in that update, I wanted to push that out for you quick snap. I’ve got a few more things lined up which will be released in a couple of weeks.