0

My Woocommerce shopping cart page displays a column for my product thumbnails, but the heading of the column is missing (screenshot). Can I add a heading here by using a filter hook? If so, can anyone suggest the particular hook to use? I've looked through the big book of Woocommerce hooks, but can't seem to find one that pertains to the headings in this table.

I am aware that I can complete this task with JavaScript, but for this particular case I would like to use a hook, if possible.

Thanks.

1

I dont know about the particular Hook but, you could do it by simply using CSS like this:

th.product-thumbnail::before{
  content: 'insert_title_here';
}
  • OK nice, that worked as expected, and will be an acceptable workaround in this particular case. But I'm actually still interested in the answer to my original question--whether there is a Woocommerce hook that could be used. The project at hand requires that I continue to modify this particular table, so viable hooks would be helpful. If there are no viable answer in a day or so, I'm happy to mark your reply as the solution (if the mods are OK with that). – cag8f May 11 '17 at 13:11
1

Unless the title is being returned from within a hooked function you probably won't be able to easily.

Going directly in and either fixing the php or creating a template within a child theme to override the one being used is going to be your best option.

  • Yes that's true--I'd need a filter hook that returns a variable containing the title of this column. I was hoping that one might exist, given the many filters Woocommerce has available. – cag8f May 14 '17 at 11:45
  • I suppose, you could look through the PHP to see if that bit of HTML is being called within a function and then overwrite it that way. Woocommerce is very very easy to manipulate, but down to the title tag, not so much. Can you post the code of the PHP file your title is in so we can see if it may be glaringly obvious :) – Jay the Geek May 14 '17 at 17:02
  • The PHP that renders the page in-question is one of the Woocommerce templates (/cart/cart.php). I've taken a quick look, and indeed this heading is missing. But Woocommerce themselves suggest that I can and should safely edit this template (by use of overrides: docs.woocommerce.com/document/template-structure). For now, I will use this approach. In the process, I may come across a hook I can use for this heading. But it turns out that I need to re-design this entire table, so I'll probably be carrying out heavy edits to this template. – cag8f May 17 '17 at 4:44
  • No no, they are correct, if it is one of those templates, create a child theme (if you dont have one) then make the same folder structure as where the template you want to override is, i'd imagine something like this woocommerce/templates/cart/ or similar. Then just copy the entire cart.php you alrady have into the new one make your change and bosch :) – Jay the Geek May 17 '17 at 14:01
  • yes, I was trying to explain that I will indeed use the Woocommerce suggested method of editing their template. I have a child theme already created, and have begun editing Woocommerce's cart.php. – cag8f May 17 '17 at 17:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.