Answers.Body: <p>I just decided to go with <code>{uri}</code> for all my asset paths now. Works well :D</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-12-07T03:37:56.150Z
Answers.LastActivityDate: 2021-12-07T03:37:56.150Z
Answers.UserDisplayName: supazu
Body: <p>I have a Matrix that I use for both Entries and Commerce Products. Inside of that Matrix is an Assets field.</p>
  <p>Currently, I have <code>{owner.parent.uri ?? owner.section.handle}/{owner.slug}</code> which works perfectly for Entries. Assets are organised perfectly for my site.</p>
  <p>How can I get add a check for Commerce in there? Something like:</p>
  <pre><code>{owner.product.type ?? owner.parent.uri ?? owner.section.handle}/{owner.slug}
  </code></pre>
  <p>Is that possible? Otherwise, do I have to use a long-hand if/else?</p>
  
Tags: <assets>
Title: Dynamic Assets location path for entries & Commerce
ThreadText: # Dynamic Assets location path for entries & Commerce
  
  (Asked by: username_0 on 2021-11-09)
  
  I have a Matrix that I use for both Entries and Commerce Products. Inside of that Matrix is an Assets field.
  
  Currently, I have `{owner.parent.uri ?? owner.section.handle}/{owner.slug}` which works perfectly for Entries. Assets are organised perfectly for my site.
  
  How can I get add a check for Commerce in there? Something like:
  
  ```
  {owner.product.type ?? owner.parent.uri ?? owner.section.handle}/{owner.slug}
  
  ```
  
  Is that possible? Otherwise, do I have to use a long-hand if/else?
  
  **Tags:** assets
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2021-12-07. Score: 2 | Accepted answer
  
  I just decided to go with `{uri}` for all my asset paths now. Works well :D
  
  
  ---
  
  