• Resolved sebastiandanac

    (@sebastiandanac)


    Hi, Im writing my custom theme and having trouble with one thing. Wocommerce is wrapping my divs to and anchor that are linking to products. Check out the screenshots i send you, those anchor are not in my code woocommerce is adding them and dont know why. link for screenshots: https://we.tl/t-fIzrCqXxhy

    thanks

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Moderator Hari Shanker R

    (@harishanker)

    Hi @sebastiandanac

    Im writing my custom theme and having trouble with one thing. Wocommerce is wrapping my divs to and anchor that are linking to products. Check out the screenshots i send you, those anchor are not in my code woocommerce is adding them and dont know why.

    I took a look at the code you had provided. The code that wraps your products is added by WooCommerce templates.

    If you want to customize them, you would need to use template overrides to customize them: https://docs.woocommerce.com/document/template-structure/

    If you want to know more about making your custom theme compatible with WooCommerce, please go through this doc: https://docs.woocommerce.com/document/woocommerce-theme-developer-handbook/

    I hope that helps!

    Thread Starter sebastiandanac

    (@sebastiandanac)

    Yes but why is it wrapping divs that are not part of woocommerce ? how can i preserve that ?

    Plugin Support Stuart Duff – a11n

    (@stuartduff)

    Automattic Happiness Engineer

    Hi @sebastiandanac,

    Looking at your site today which is https://foryou.toys/ when I inspect the code output using Chrome Dev Tools the Uncategorized text is not actually originating from WooCommerce and seems to be part of the custom theme you’re using/creating.

    By default when you cross-check against a default theme like Storefront or Twenty Nineteen the HTML structure is different from what I see on your site.

    This is what the HTML category title on a default install of WooCommerce looks like using the Storefront theme.

    Image Link: https://cloudup.com/cG8BmlhHeoh

    On your site, you’ll notice the HTML is very different to that of the default WooCommerce plugins output.

    Image Link: https://cloudup.com/cSSuLBqHbNf

    This indicates that it’s actually not WooCommerce which is adding this HTML but something to do with your theme itself as neither StoreFront or TwentyNinteen are adding any similar HTML markup.

    WooCommerce does, however, add some HTML to wrap page content. You can remove or alter those by using actions though.

    https://docs.woocommerce.com/document/woocommerce-theme-developer-handbook/#section-3

    I hope this helps.

    Thread Starter sebastiandanac

    (@sebastiandanac)

    I understand but check out this img https://we.tl/t-NQP6yeFd6r its directly from my tamplate php file its a acf pro repeater field that repeats the code and through admin inputting the name to h4 and link to anchor and different parameters do woocommerce shortcode

    but the thing is that on the page its all looks different like you see in the inspector bcs woocoommerce is wrapping it to a tag (if i deactive all plugins except woocommerce its still doing it)

    Plugin Support Stuart Duff – a11n

    (@stuartduff)

    Automattic Happiness Engineer

    As you will have seen from my screenshots when cross-testing for us using the Storefront and TwentyNinteen themes we’ve not been able to replicate WooCommerce adding an <a href> to any page or product category titles.

    As you mentioned shortcodes I have also tested by adding the Product Shortcode to a page in TwentyNineteen and no title text was added when using the shortcode and the page title was not linked as a consequence.

    What you’re experiencing is at the moment isolated to only the theme you’re creating and could be related to the way you’ve written the code for that. Try removing some of the code to see if you can narrow down the cause.

    Thread Starter sebastiandanac

    (@sebastiandanac)

    as i mentioned and clearly it can be seen in my code, im adding the title of the category with my cutsom fiel but the problem is that woocommerce is wrapping it to and anchor tag and its a problem on the whole site, checkoout this: in my code there is no anchor tag https://we.tl/t-dmam0Fz7tx

    Plugin Support Stuart Duff – a11n

    (@stuartduff)

    Automattic Happiness Engineer

    As indicated it’s not something which can be replicated outwith the custom code you’ve written. We’ll leave this topic open for a while though to see if other members of the community can assist you with your code!

    Thread Starter sebastiandanac

    (@sebastiandanac)

    All i was asking that how is woocommerce adding product link tags and how can it happen that they are where the shouldnt. I dont feel like either of you want to solve the problem. I wont mark it as solved bcs its was just a waste of time you can mark it as closed bcs im going off

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Woocommerce is wrapping my custom html tags to Anchor tag’ is closed to new replies.