# BuyButtonに独自のスタイルシートは当てれないのでしょうか？

**URL:** <https://community.shopify.com/t/buybutton/40667>\
**Category:** 技術的なQ＆A\
**Created:** [March 24, 2021, 2:26am UTC](https://community.shopify.com/t/buybutton/40667 "2021-03-24T02:26:02Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Jizo\_Inagaki](https://yyz1.discourse-cdn.com/shopifyforum/user_avatar/community.shopify.com/jizo_inagaki/32/149480_2.png) [@Jizo\_Inagaki](https://community.shopify.com/u/Jizo_Inagaki)\
**Post date:** [April 7, 2021, 11:51am UTC](https://community.shopify.com/t/buybutton/40667/2 "2021-04-07T11:51:00Z")

</div>

Chromeでしか確認していませんが試したところエラーは出なかったので、恐らく以下のようなJSで実現はできるかとは思います。他のブラウザで動かなかった場合は申し訳ありません。

```javascript
const addStyleSheet = () => {
  // 以下の#collection-component-xxxxxはBuybutton用のコードの上部にあるdivのidを指定
  const t = document.querySelector('#collection-component-xxxxx iframe');
  const css = ``;
  t.contentWindow.document.getElementsByTagName('head')[0].insertAdjacentHTML('beforeend',css);
}
window.setTimeout(addStyleSheet, 2000);

```

setTimeoutで2秒後に実行したりと全体的に適当に作っていますので、適宜変更された方が良いと思います。

なおこの件はShopify特有のものではなくiframe内のドキュメントを書き換えるという類のものなので、そちらの方向で調べて試されることをお勧めします。

---

_[View the full topic](https://community.shopify.com/t/buybutton/40667)._
