Title: Modify Cache Key
Last modified: January 13, 2021

---

# Modify Cache Key

 *  Resolved [Nate1](https://wordpress.org/support/users/nate1/)
 * (@nate1)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/modify-cache-key/)
 * Hello,
 * Is it possible to vary cache by the Cloudflare country value i.e. HTTP_CF_IPCOUNTRY
   
   Is there a hook or similar that could be used to append the value and allow for
   variation for the customers.
 * I’d like to use this to display prices including and including taxes.
    That would
   mean simply two variations of the cache in this instance. I’d also expect its
   only needed against the page cache as is just a small change for how the html
   is rendered. The dynamic functions load the prices correctly once a shipping 
   address is added.
 * Thank you

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Thread Starter [Nate1](https://wordpress.org/support/users/nate1/)
 * (@nate1)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/modify-cache-key/#post-13900380)
 * Found the solution,
 * Set Page Cache = Basic
 * Then modify, did look to vary a little when printing the values. Some including
   gzip but others not. A good definition of how this should be used would be good,
   but does appear to be working currently.
 *     ```
       dd_filter('w3tc_page_extract_key', 'theme_w3tc_page_extract_key', 40, 8);
       function theme_w3tc_page_extract_key($_page_key,
       	$useragent,
       	$referrer,
       	$encryption,
       	$compression,
       	$content_type,
       	$uri,
       	$page_key_extension){
   
       	return $_page_key . $country_code;
       }
       ```
   
 *  Plugin Contributor [Marko Vasiljevic](https://wordpress.org/support/users/vmarko/)
 * (@vmarko)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/modify-cache-key/#post-13901031)
 * Hello [@nate1](https://wordpress.org/support/users/nate1/)
 * Thank you for your inquiry and your suggestions.
    I need to check and get back
   to you on this once I can confirm if this can be done. Thanks!
 *  Plugin Contributor [Marko Vasiljevic](https://wordpress.org/support/users/vmarko/)
 * (@vmarko)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/modify-cache-key/#post-13908694)
 * Hello [@nate1](https://wordpress.org/support/users/nate1/)
 * Thank you for your patience.
    As you can see here: [https://github.com/W3EDGE/w3-total-cache/blob/feature-showcase/PgCache_ContentGrabber.php#L334-L343](https://github.com/W3EDGE/w3-total-cache/blob/feature-showcase/PgCache_ContentGrabber.php#L334-L343)
   It has a condition `if ( $with_filter ) {` I hope this helps! Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Modify Cache Key’ is closed to new replies.

 * ![](https://ps.w.org/w3-total-cache/assets/icon-256x256.png?rev=1041806)
 * [W3 Total Cache](https://wordpress.org/plugins/w3-total-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/w3-total-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/w3-total-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/w3-total-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/w3-total-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/w3-total-cache/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Marko Vasiljevic](https://wordpress.org/support/users/vmarko/)
 * Last activity: [5 years, 4 months ago](https://wordpress.org/support/topic/modify-cache-key/#post-13908694)
 * Status: resolved