1

I'm using Drupal Commerce and a View that displays all my products of a certain type.

The first item displayed in the view (for each product) is the Title and it is helpfully linked to the product page.

I also want to add another link to the product page that says 'Register Now' but I can't figure out how to create custom text that also links to the product page!

I've tried adding the product UUID, ID, and 'Link to Product' fields in my View...and putting them above my 'Custom Text' field...but none seem to work.

When I use {{ id }} for example (as the link in the custom text field), it just makes the link '/id' ...but that's not the actual link to the product, so naturally I get an error. The same problem persists for the other referenced fields.

So...anyone know how to create custom text that links to the actual product?

1

Option A)

You could add another Title and then simply override the title so it says Register Now by Rewriting the results of the field.

Option B)

Add path as a field and exclude from display.

Add a Custom Text and checkmark display this field as a link and use {{ path }} as your url.

  • Neither of these options worked for me. I'd already tried the 'Title' idea actually...I added it (again) and then clicked 'Link to the Product' (I also tried without clicking that option). Under 'Rewrite Results' I'd checked 'Override the output of this field with custom text' > 'Register Now'...but it just makes the field a plain text output! There is no path field available to add to the View. – Sage Jun 7 '17 at 16:37
  • How about the Link to Content field, is that available? It's probably called Link to Product if it even exists. – No Sssweat Jun 7 '17 at 17:08
  • Yes that worked! For some reason it didn't work for me before...weird. – Sage Jun 7 '17 at 23:22

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.